PHP Log Class
ob_start();
echo "<pre>";
print_r($content);
echo "</pre>";
$a=ob_get_contents();
$filename = $_SERVER['DOCUMENT_ROOT']."/log-".date("Y-m-d").".txt";
$file = fopen($filename, "a");
$tipmsg = "\r\n******Final File: "
//.end(explode('/',$_SERVER['PHP_SELF']))
.$_SERVER['PHP_SELF']
."\r\n******Code Container: "
.str_replace("\\","/",substr(__FILE__,strlen($_SERVER['DOCUMENT_ROOT'])))
."\r\n******Time: "
.date("Y-m-d H:i:s")."\r\n\r\n";
fwrite($file, $a.$tipmsg);
fclose($file);
ob_end_clean();
相关文档:
函数的引用返回
先看代码 复制PHP内容到剪贴板
PHP代码:
function &test()
{
static $b=0;//申明一个静态变量
$b=$b+1;
echo $b;
return $b;
}
$a=test();//这条语句会输出 $b的值 为1
$a=5;
$a=test();//这条语句会输出 $b的值 为2
$a=&test();//这条语句会输出 $b的值 为3
$a=5;
$a=test( ......
PHP基本语法和数据类型:
(1)、PHP基本语法:
1、htm 和 php 混编
2、一个语句以 ; (分号结束)
3、如何定义一个变量,和变量的使用
(2)PHP数据运算类型
四种标量类型:
boolean(布尔型) 理解为真假型
integer(整型)
float(浮点型,也作 ......
php中set_include_path函数用法:
php中的set_include_path函数可用于设置应用程序目录,开发项目时合理应用这些函数,不但可以让我们在include时不用一层一层的计算目录,还可以提高我们开发的效率,减少文件包含错误率.
例如:
简历2个php文件,一个目录
位置结构如下
/index.php
/include/config.php
index.php ......
此文章的安装方法适用于Windows XP
下的Apache+PHP+MySQL
安装,同时也适用于Windows 2003
系统下的安装和配置。
1.
安装环境
操作系统是 Windows XP
中文版, Apache,
PHP, MySQL
的最新版本是截止到 2007.09.07
,分别在其官网下载的:
* Apache 2.2.6
:http://apache.mirror.phpchina.c ......
用php生成excel文件
<?
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=test.xls");
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2 ......