centos使用crontab定时执行php脚本
首先,找到php安装环境目录, whereis php 得到目录:假设/opt/lampp/bin/php,记录下来 写好php脚本 [php]view plain copy require_once("/home/web/wxsq/config.php"); $link=mysqli_connect($host,$user,$pwd,$dbname); if(!$link){ echo"Error:UnabletoconnecttoMySQL.".PHP_EOL; echo"Debuggingerrno:".mysqli_connect_errno().PHP_EOL; echo"Debuggingerror:".mysqli_connect_error().PHP_EOL; die("Connectionerror:".mysqli_connect_error()); } mysqli_query($link,"setcharacterset'utf8'");//è¯? mysqli_query($link,"setnames'utf8'"); //$sql="DELET...
