Created
October 30, 2015 03:26
-
-
Save koki-h/245e8de67e74b6b52c7f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #rubyの中からPHPスクリプトを実行するサンプル | |
| def php_exec(script) | |
| IO.popen("php ", "r+") do |php| | |
| php.puts("<?php") | |
| php.puts(script) | |
| php.puts("?>") | |
| php.close_write | |
| php.gets | |
| end | |
| end | |
| php_script = %q| | |
| $name = "hogehoge"; | |
| echo "hello " . $name; | |
| | | |
| puts php_exec(php_script) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment