在命令行上从 Windows 批处理文件执行远程服务器 php 脚本
我的托管 linux/unix 服务器上有一个 php 脚本。我想为 windows/linux 创建一个 CLI 来执行我的 PHP 脚本。 对于linux,我可以创建一个shell脚本,它可以使用url、curl等方法执行我的php脚本。 但是我如何从 Windows CLI(批处理文件)执行 php 脚本。如果对 Linux CLI 有任何好的建议,我们将不胜感激。
谢谢, 潘卡伊
I have a php script on my hosted linux/unix server.I want to create a CLI for windows/linux both for executing my PHP script.
for linux i can create a shell script that can execute my php script by using methods like url,curl).
But how can i execute php script from a windows CLI (batch file). If any good suggestion for Linux CLI would be appreciated.
Thanks,
Pankaj
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以下载适用于 win32 的 sh.exe (Bash),它可以让您在两个平台上运行相同的脚本。在 Windows 上,你只需要执行
sh.exe script.sh
我一直使用这种方法,因为 BAT 编程是一种徒劳且可怕的浪费时间的练习。
http://unxutils.sourceforge.net/
编辑:哦等等,我以为你正在尝试运行 PHP网站上的脚本(即通过 wget)。我不确定在 win32 上将 PHP 作为 CLI 运行有什么影响。
You can download sh.exe (Bash) for win32 which will let you run the same script on both platforms. On windows then you only need to do
sh.exe script.sh
I use this method all the time because BAT programming is such a futile and terrible exercise in time-wasting.
http://unxutils.sourceforge.net/
EDIT: Oh wait, I thought you were trying to run a PHP script on a website (ie, via wget). I'm not sure what the implications of running PHP as CLI on win32 are.