简体   繁体   English

在IIS下运行的PHP上创建计划任务

[英]Creating A Scheduled Task on PHP Running Under IIS

I'm fairly new to PHP. 我是PHP的新手。 I need to run a function on my PHP site on a daily basis. 我需要每天在我的PHP站点上运行一个函数。 I have seen posts on how to do this under Linux, but I'm running the PHP site on Windows Server 2012 under IIS. 我已经看过有关如何在Linux下执行此操作的帖子,但我在IIS下的Windows Server 2012上运行PHP站点。 How can I create a PHP function and then run it at a certain time each day? 如何创建PHP函数,然后每天在特定时间运行它?

Run Cron Job on PHP Script, on localhost in Windows 在PHP脚本上运行Cron Job,在Windows中的localhost上运行

Create script.bat file with below Code 使用以下代码创建script.bat文件

"C:\\wamp\\bin\\php\\php5.4.12\\php.exe" -f "C:\\wamp\\www\\website\\my_process.php" “C:\\ wamp \\ bin \\ php \\ php5.4.12 \\ php.exe”-f“C:\\ wamp \\ www \\ website \\ my_process.php”

Change wamp path to your iis path 将wamp路径更改为iis路径

Download & Install Zcron From Below Link 从链接下载并安装Zcron

http://www.z-cron.com/download.html http://www.z-cron.com/download.html

Create New Task select your script.bat file and set timer 创建新任务选择您的script.bat文件并设置计时器

您可以使用服务器上的任务计划程序运行批处理文件,该文件通过命令行定期运行PHP脚本,我希望能解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM