在命令行上从 Windows 批处理文件执行远程服务器 php 脚本

发布于 2024-10-16 11:42:06 字数 210 浏览 8 评论 0原文

我的托管 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感受沵的脚步 2024-10-23 11:42:06

您可以下载适用于 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文