如何从批处理文件执行php codeigniter控制器
当我试图在命令行上手动运行脚本时,工作正常。批处理文件中运行的相同代码无效。 如何在批处理文件中运行CodeIgniter控制器 文件名:crone-job.bat如何从批处理文件执行php codeigniter控制器,php,batch-file,codeigniter-3,Php,Batch File,Codeigniter 3,当我试图在命令行上手动运行脚本时,工作正常。批处理文件中运行的相同代码无效。 如何在批处理文件中运行CodeIgniter控制器 文件名:crone-job.bat cd D:\www\Apache2.4\htdocs\reech\ D:\php7.0\php.exe index.php crone/recordCountStatus >D:\www\Apache2.4\htdocs\reech\result.txt 错误:无法打开输入文件:index.php我不认为您的案例和我一样,
cd D:\www\Apache2.4\htdocs\reech\
D:\php7.0\php.exe index.php crone/recordCountStatus >D:\www\Apache2.4\htdocs\reech\result.txt
错误:无法打开输入文件:index.php我不认为您的案例和我一样,我希望这可以解决它,就像我的案例:
- 视窗10
- PHP版本5.6.23
- XAMPP v3.2.2
@echo off
set "PATH=%PATH%;e:\folder1\xampp\htdocs\currentworkspace"
call e:
call cd folder1\xampp\htdocs\currentworkspace
:loop
call php index.php our_controller_name
PING 1.1.1.1 -n 3 -w 10000 >NUL
goto :loop
并保存:)
“呼叫e:”这是我的工作代码 步骤1:选择驱动器“D”或 步骤2:选择应用程序位置 步骤3:php位置“D:\php\php.exe”或在环境变量中设置 第4步:index.php后跟控制器\名称/方法\名称ex:index.php crone/recordCountStatus 步骤5:另存为.bat文件,并在任务计划程序中运行此文件
D:
cd www\Apache2.4\htdocs\reech\
set LOGFILE_DATE=%DATE:~6,4%-%DATE:~3,3%-%DATE:~0,2%
set LOGFILE_TIME=%TIME:~0,2%-%TIME:~3,2%
set LOGFILE=%LOGFILE_DATE%-%LOGFILE_TIME%
D:\php\php.exe index.php crone/recordCountStatus >>D:\www\Apache2.4\htdocs\reech\cron\log\dump-import-elasticsearch-log.txt