定义和用法 error_log() 函数向服务器错误记录、文件或远程目标发送一个错误。 如果成功该函数返回 TRUE,如果失败该函数返回 FALSE。 语法 error_log(error,type,destination,headers) 参数 描述 error 必需。要记录的错误消息。 type 可选。规定错误记录的类型。 可能的记录类型: 0 - 默认
定义和用法 error_get_last() 函数获得最后发生的错误。 该函数以数组的形式返回最后发生的错误。如果没有错误发生则返回 NULL。 返回的错误数组包含 4 个键名和键值: [type] - 错误类型 [message] - 错误消息 [file] - 发生错误所在的文件 [line] - 发生错误所在的行 语法 error_get_last() 实例 <?php echo
定义和用法 debug_print_backtrace() 函数打印 backtrace。 该函数显示由 debug_print_backtrace() 函数代码生成的数据。 语法 debug_print_backtrace() 实例 <?php function one($str1, $str2) { two("Glenn", "Quagmire"); } function
定义和用法 debug_backtrace() 函数生成 backtrace。 该函数显示由 debug_backtrace() 函数代码生成的数据。 返回一个关联数组。下面是可能返回的元素: 名称 类型 描述 function string 当前的函数名。 line integer 当前的行号。 file string 当前的文件名。 class string 当前的类名。 object
实例 列出 images 目录中的文件和目录: <?php$dir = "/images/";// Sort in ascending order - this is default$a = scandir($dir);// Sort in descending order$b = scandir($dir,1);print_r($a);print_r($b);?> 结果: Array([0]
实例 打开一个目录,列出其中的文件,充值目录句柄,重新列出其中的文件,然后关闭: <?php$dir = "/images/";// Open a directory, and read its contentsif (is_dir($dir)){ if ($dh = opendir($dir)){ // List files in images directory while (($
实例 打开一个目录,读取它的内容,然后关闭: <?php$dir = "/images/";// Open a directory, and read its contentsif (is_dir($dir)){ if ($dh = opendir($dir)){ while (($file = readdir($dh)) !== false){ echo "filename:"
实例 打开一个目录,读取它的内容,然后关闭: <?php$dir = "/images/";// Open a directory, and read its contentsif (is_dir($dir)){ if ($dh = opendir($dir)){ while (($file = readdir($dh)) !== false){ echo "filename:"
实例 获取当前工作目录: <?phpecho getcwd()?> 结果: /home/php 定义和用法 getchwd() 函数返回当前工作目录。 语法 getcwd(); 技术细节 返回值: 成功则返回当前工作目录。失败则返回 FALSE。 PHP 版本: 4.0+
实例 使用 dir() 函数: <?php $d = dir(getcwd());echo "Handle: " . $d->handle . "<br>"; echo "Path: " . $d->path . "<br>";while (($file = $d->read()) !== false){ echo "filename: " . $file