腳本是直接寫在前端的,可以直接通過url方式,後來增加了一些參數,
在做計劃任務時,執行腳本
/usr/local/php55/bin/php /data/www/tppblog/index.php home/flow/index flush,index.php是入口文件,後面是url。flush是用argv接收的參數,防止通過url亂刷
一開始報錯,說是找不到./ThinkPHP/ThinkPHP.php,位置顯示在index.php中,
if(version_compare(PHP_VERSION,'5.3.0','<')) die('require PHP > 5.3.0 !');
// 開啓調試模式 建議開發階段開啓 部署階段註釋或者設爲false
define('APP_DEBUG',true);
// define('BUILD_CONTROLLER_LIST','Index,User,Menu');
// 定義應用目錄
define('APP_PATH','./front/');
// 引入ThinkPHP入口文件
require './ThinkPHP/ThinkPHP.php';
後來修改成
define('APP_PATH',__DIR__'/front/');
require __DIR__'/ThinkPHP/ThinkPHP.php';
這樣既可