我有1个文件php:C:\\Xml2InDesign\\InDesignTagConverter.php
我通过以下方式执行:
$sjis_cmd="php \"C:\\Xml2InDesign\\InDesignTagConverter.php\";
exec($sjis_cmd, $output);
它不起作用。我必须设置什么?
我从cmd运行:
php "C:\Xml2InDesign\InDesignTagConverter.php" "c:\work\link2\\tmp\\5699\\direction.xml" "c:\work\link2\\tmp\\5699\\tables"
显示错误:'php' is not recognized...
答案 0 :(得分:2)
找到你的php.exe路径并从那里运行命令。
如果您的php.exe在C:\PHP5\php.exe
中,那么就可以像这样执行
C:\PHP5\php.exe "C:\\Xml2InDesign\\InDesignTagConverter.php\"
请参阅此link
或强>
如果你想通过php代码运行它,那么使用exec命令
答案 1 :(得分:1)
The PHP CLI as its called ( php for the Command Line Interface ) is called php.exe It lives in c:\wamp\bin\php\php5.x.y\php.exe ( where x and y are the version numbers of php that you have installed )
If you want to create php scrips to run from the command line that great its easy and very useful.
Create yourself a batch file like this, lets call it phppath.cmd :
PATH=%PATH%;c:\wamp\bin\php\php5.x.y php -v
Save this into one of your folders that is already on your PATH, so you can run it from anywhere.
Now from a command window, cd into your source folder and run >phppath.
Then run
php your_script.php