很多站长朋友们都不太清楚双鱼林php代码自动,今天小编就来给大家整理双鱼林php代码自动,希望对各位有所帮助,具体内容如下:
本文目录一览: 1、 PHP中有什么好的代码自动检查工具吗 2、 php 自动计算12生肖 3、 请问怎么才能让php每隔一段时间自动执行一段代码 4、 如何编写让php页面自动刷新 5、 如何用php作Linux自动执行脚本? PHP中有什么好的代码自动检查工具吗当然有。
PHP Mess Detector(
PHP项目体检工具,根据你设定的标准(如单一文件代码体积,未使用的参数个数,未使用的方法数)检查PHP代码,超出设定的标准时报警。
PHP Copy Paste Detector(
顾名思义,检查冗余代码的
PHP Dead Code Detector
看名字就知道了,检查从未被调用过的方法
PHP Code Sniffer
老牌代码格式化工具,PHP写的,Pear包,可自己hack,可集成到命令行里。我一直用的PHP Code Beautifier,只有Windows GUI,Windows CMD很难用,已经打算跳槽到PHP CS了
php 自动计算12生肖<?php
//2002/10/23-->出生年月
/*
计算12个星座
计算12个生肖
计算年龄
*/
class timeage
{
public $y = 0;
public $m = 0;
public $d = 0;
public $age = 0;
public $time = 0;
public function __construct($time)
{
$this->time = $time;
$this->y = date('Y',$this->time);
$this->m = date('m',$this->time);
$this->d = date('d',$this->time);
}
public function getage()
{
$this->age = time() - $this->time;
$this->age = $this->age/60/60/24/365;
return (int)$this->age;
}
public function getconstellation()
{
switch ($this->m)
{
case 1:
if ($this->d < 19)
{
$this->constellation = '摩羯座';
return $this->constellation;
}
else
{
$this->constellation = '水瓶座';
return $this->constellation;
}
break;
case 2:
if ($this->d < 18)
{
$this->constellation = '水瓶座';
return $this->constellation;
}
else
{
$this->constellation = '双鱼座';
return $this->constellation;
}
break;
case 3:
if ($this->d < 20)
{
$this->constellation = '双鱼座';
return $this->constellation;
}
else
{
$this->constellation = '白羊座';
return $this->constellation;
}
break;
case 4:
if ($this->d < 19)
{
$this->constellation = '白羊座';
return $this->constellation;
}
else
{
$this->constellation = '金牛座';
return $this->constellation;
}
break;
case 5:
if ($this->d < 20)
{
$this->constellation = '金牛座';
return $this->constellation;
}
else
{
$this->constellation = '双子座';
return $this->constellation;
}
break;
case 6:
if ($this->d < 21)
{
$this->constellation = '双子座';
return $this->constellation;
}
else
{
$this->constellation = '巨蟹座';
return $this->constellation;
}
break;
case 7:
if ($this->d < 22)
{
$this->constellation = '巨蟹座';
return $this->constellation;
}
else
{
$this->constellation = '狮子座';
return $this->constellation;
}
break;
case 8:
if ($this->d < 22)
{
$this->constellation = '狮子座';
return $this->constellation;
}
else
{
$this->constellation = '处女座';
return $this->constellation;
}
break;
case 9:
if ($this->d < 22)
{
$this->constellation = '处女座';
return $this->constellation;
}
else
{
$this->constellation = '天秤座';
return $this->constellation;
}
break;
case 10:
if ($this->d < 23)
{
$this->constellation = '天秤座';
return $this->constellation;
}
else
{
$this->constellation = '天蝎座';
return $this->constellation;
}
break;
case 11:
if ($this->d < 22)
{
$this->constellation = '天蝎座';
return $this->constellation;
}
else
{
$this->constellation = '射手座';
return $this->constellation;
}
break;
case 12:
if ($this->d < 20)
{
$this->constellation = '射手座';
return $this->constellation;
}
else
{
$this->constellation = '摩羯座';
return $this->constellation;
}
break;
}
}
public function getzodiac()
{
$this->animals = array('鼠', '牛', '虎', '兔', '龙', '蛇','马', '羊', '猴', '鸡', '狗', '猪');
$this->zodiac = ($this->y - 1900) % 12;
return $this->animals[$this->zodiac];
}
}
$age = strtotime('1993-07-25');
echo $age;
$a = new timeage($age);
echo '<br>';
echo $a->y;
echo '<br>';
echo $a->m;
echo '<br>';
echo $a->d;
echo '<br>';
echo $a->time;
echo '<br>';
echo $a->age;
echo '<br>';
echo $a->getage();
echo '<br>';
echo $a->getconstellation();
echo '<br>';
echo $a->getzodiac();
//没事干替你写了个全部的功能函数 写代码类 记得给好评
请问怎么才能让php每隔一段时间自动执行一段代码PHP有sleep()函数
另外也可以结合xajax或JS来做
xajax 0.5 有延时方法
JS有 setTimeout()
都可以的~~
如何编写让php页面自动刷新需要准备的材料分别是:电脑、php编辑器、浏览器。
1、首先,打开php编辑器,新建php文件,例如:index.php。
2、在index.php中,输入代码:echo ("<script>setTimeout('window.location.reload()', 1);</script>");。
3、浏览器运行index.php页面,此时发现页面会自动刷新。
如何用php作Linux自动执行脚本?如何用PHP作Linux自动执行脚本? 在安装PHP的时候,会产生一个可执行文件,文件名为PHP.将它 copy 到 /usr/local/bin 下.在终端方式执行PHP程序: PHP -q onlinnum.PHP PHP 原本是应用在网页应用的﹐因此它会送出 HTML 的HEADER﹐但是在此我们是要将 PHP 用作 Shell Script﹐-q 就是表示不要送 出 HEADER 的意思.你可以试试看不加上 -q 的显示结果。此时你已经可以在终端方式下执行PHP 代码了。 linux命令:cron daemon 这是一个系统中常驻的服务,功能在于执行例行性的工作,如每天一次或每月一 次检查磁盘。cron daemon 会在每分钟检查一次排定的工作表(crontab),看看是否有要执行的指令,所有的输出会以mail寄给用户。 设置crontab 命令:crontab -e 该命令呼叫vi编辑器来编辑执行的清单。例如 0 0 1,15 * * fsck /home 1 * * * * /home/myhome/printhello 每一行代表一项排定的工作,在指令前为排定的时间,总共有5个栏位,以空格间隔,由左到右依序如下: -------------------------- 分钟 从00到 99 点钟 从0到 24 日从01到31 月从01到12 星期 从01到07,代表星期一到星期日 *号表示每 ,如每天执行,就在第三栏填*号 -------------------------- 所以上例的两项工作是: 每月1号和15号检查/home 磁盘 每小时的第一分执行 /home/myhome/printhello 这个文件 查看crontab:crontab -l 删除crontab:crontab -r 我们就知道该怎么利用PHP和crontab命令作Linux自动执行脚本了。 还需要注意什么问题? 如果PHP中有使用数据库,如oracle等,执行脚本中还需export Oracle的环境设置。
关于双鱼林php代码自动的介绍到此就结束了,不知道本篇文章是否对您有帮助呢?如果你还想了解更多此类信息,记得收藏关注本站,我们会不定期更新哦。