|
√ Google adsense申请技巧 √ 本站核心代理域名注册主机业务
√ 快速发布你的买卖域名买卖网站信息
√ 1元注册 cn域名
√ 站长每日新闻导读 √ ·推荐万网空间¥120元 150m √ 站长网:站长必上的网站 √ 网站联盟大全 √ 本站代理万网域名55空间120元 |
4:为什么我向另一网页传送变量时,只得到前半部分,以空格开头的则全部丢失
PHP代码:
<?php
$Var="hello php";//修改为$Var=" hello php";试试得到什么结果
$post= "receive.php?Name=".$Var;
header("location:$post");
?>
receive.php的内容:
PHP代码:
<?PHP
Echo "<pre>";
Echo $_GET["Name"];
Echo "</pre>";
?>
正确的方法是:
PHP代码:
<?php
$Var="hello php";
$post= "receive.php?Name=".urlencode($Var);
header("location:$post");
?>
在接收页面你不需要使用Urldecode(),变量会自动编码.
5:我怎么知道系统默认支持什么函数
PHP代码:
<?php
$arr = get_defined_functions();
Function php() {
}
echo "<pre>";
Echo "这里显示系统所支持的所有函数,和自定以函数php\n";
print_r($arr);
echo "</pre>";
?>
6:如何比较两个日期相差几天
PHP代码:
<?PHP
$Date_1="2003-7-15";//也可以是:$Date_1="2003-7-15 23:29:14";
$Date_2="1982-10-1";
$d1=strtotime($Date_1);
$d2=strtotime($Date_2);
$Days=round(($d1-$d2)/3600/24);
Echo "偶已经奋斗了 $Days 天^_^";
?>
7:为什么我升级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?
8:我想在每个文件最前,最后面都加上一文件.但一个一个添加很麻烦
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.php";
?>