首页 > 开发 > PHP > 正文

PHP 选项及相关信息函数库

2024-05-04 22:14:24
字体:
来源:转载
供稿:网友
error_log :  送出一个错误信息。  
error_reporting :  配置错误信息回报的等级。  
getenv :  取得系统的环境变量  
get_cfg_var :  取得 PHP 的配置选项值。  
get_current_user :  取得 PHP 行程的拥有者名称。  
get_magic_quotes_gpc :  取得 PHP 环境变量 magic_quotes_gpc 的值。  
get_magic_quotes_runtime :  取得 PHP 环境变量 magic_quotes_runtime 的值。  
getlastmod :  返回该网页的最后修改时间。  
getmyinode :  返回该网页的 inode 值。  
getmypid :  返回 PHP 的行程代号。  
getmyuid :  返回 PHP 的用户代码。  
getrusage :  返回系统资源使用率。  
phpinfo :  返回 PHP 所有相关信息。  
phpversion :  返回 PHP 版本信息。  
putenv :  配置系统环境变量。  
set_magic_quotes_runtime :  配置 magic_quotes_runtime 值。  
set_time_limit :  配置该页最久执行时间。  

int error_log
语法: int error_log(string message, int message_type, string [destination], string [extra_headers]);
返回值: 整数
函数种类: PHP 系统功能
内容说明: 此函数会送出错误信息到 Web 服务器的错误 log 文件,TCP Port,或到指定文件。第一个参数 message 即为要送出的错误信息。第二个参数 message_type 为整数值:0 表示送到操作系统的 log (UNIX 在 syslog、Windows NT 记录到事件记录);1 则使用 PHP 的 Mail() 函数,送信息到某 E-Mail 处,第四个参数 extra_headers 亦会用到;2 则将错误信息送到 TCP 埠,此时第三个参数 destination 表示目的地 IP 及 Port;3 则将信息存到文件 destination 中。
使用范例 
本例为登入 Oracle 数据库出现问题的处理。
<?php
if (!Ora_Logon($username, $password)) {
error_log("Oracle 数据库不可用!", 0);
}
if (!($foo = allocate_new_foo()) {
error_log("出现大麻烦了!", 1, "webmaster@www.mydomain.com.tw");
}
error_log("搞砸了!", 2, "127.0.0.1:7000");
error_log("搞砸了!", 2, "loghost");
error_log("搞砸了!", 3, "/var/tmp/my-errors.log");
?> 
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表