• 本帖最后由 Eric.c 于 2017-7-3 12:11 编辑 *

看到还是有人老是关注7o 1t 版本,没事按下f5.... 所以给大家撸了一个代码玩玩。。。
已在4台服务器上测试过了。 能帮到也就酱紫了。。。
**
github: https://github.com/jekyllcao/online.net
**

确保是linux服务器,已经安装了php

将下面的代码给保存成一个php文件(如文件名a.php),然后设置crontab 的任务。

crontab -e 回车
按 i ,然后输入 /1 * php的执行路径 a.php的绝对路径
按esc ,再输入:wq 退出。

ps: 如果你php安装的是lnmp套件(lnmp.org),那么php的执行路径是 : /usr/bin/php,
如果你不确定,直接输入which php, 会有返回值

  • $text, 'desp' => $desp));
  • $opts = array('http' =>
  • array(
  • 'method' => 'POST',
  • 'header' => 'Content-type: application/x-www-form-urlencoded',
  • 'content' => $postdata
  • )
  • );
  • $context = stream_context_create($opts);
  • return $result = file_get_contents('http://sc.ftqq.com/'.$key.'.send', false, $context);
  • }
  • 复制代码

====FAQ:=====

1/ 不要直接在服务器上用vim修改,因为vim对中文的支持。。。。 所以还是在你本地上存文件后再上传吧
2/ 上传后,手动执行一遍 php a.php , 看看是否有报错。
3/ 如果报错,一般是php.ini中的disable_function函数禁止了,编辑这个文件,直接注释掉这行后重启 lnmp 或者php-fpm 即可
4/ 代码无技术支持。。。 别找我。。。 也别让我写自动登录和提交(看懂代码的自己扩展,so easy,需要花时间而已)。。。。
![](titter.gif)

> "

  • $text, 'desp' => $desp));
  • $opts = array('http' =>
  • array(
  • 'method' => 'POST',
  • 'header' => 'Content-type: application/x-www-form-urlencoded',
  • 'content' => $postdata
  • )
  • );
  • $context = stream_context_create($opts);
  • return $result = file_get_contents('http://sc.ftqq.com/'.$key.'.send', false, $context);
  • }
  • - - - function sendmail($title,$desp,$to)
  • {
  • $cmd = "echo "$desp" | mail -s "$title" $to";
  • $data = shell_exec($cmd);
  • if ( strpos($data,"not sent")) {
  • echo "Fail to send ".$data;
  • }
  • else
  • {
  • echo "Mail Sent";
  • }
  • - - }
  • 复制代码