Echo "这里显示系统所支持的所有函数,和自定以函数php\n";
print_r($arr);
echo "</pre>";
?>
10:如何比较两个日期相差几天
PHP代码:
<?PHP
$Date_1="2003-7-15";//也可以是:$Date_1="2003-6-25 23:29:14";
$Date_2="1982-10-1";
$Date_List_1=explode("-",$Date_1);
$Date_List_2=explode("-",$Date_2);
$d1=mktime(0,0,0,$Date_List_1[1],$Date_List_1[2],$Date_List_1[0]);
$d2=mktime(0,0,0,$Date_List_2[1],$Date_List_2[2],$Date_List_2[0]);
$Days=round(($d1-$d2)/3600/24);
Echo "我已经学习了 $Days 天^_^";
?>
11:为什么我升级PHP后,原来的程序出现满屏的 Notice: Undefined variable:
这是警告的意思,由于变量未定义引起的.
打开php.ini,找到最下面的error_reporting,修改为error_reporting = E_ALL & ~E_NOTICE
对于Parse error错误
error_reporting(0)无法关闭.
如果你想关闭任何错误提示,打开php.ini,找到display_errors,设置为display_errors = Off.以后任何错误都不会提示.
那什么是error_reporting?
12:我想在每个文件最前,最后面都加上一文件.但一个一个添加很麻烦
1:打开php.ini文件
设置 include_path= "c:"
2:写两个文件
auto_prepend_file.php 和 auto_append_file.php 保存在c盘,他们将自动依附在每个php文件的头部和尾部.
3:在php.ini中找到:
Automatically add files before or after any PHP document.
auto_prepend_file = auto_prepend_file.php;依附在头部
auto_append_file = auto_append_file.php;依附在尾部
以后你每个php文件就相当于
PHP代码
<?php
Include "auto_prepend_file.php" ;
.......//这里是你的程序
Include "auto_append_file.
| 对此文章发表了评论 |
