PHP(二)

1.PHP事务加X锁
    $sql = "SET TRANSACTION ISOLATION LEVEL REPEATABLE READ";
    $result = mysql_query($sql, $con);
2.PHP随机整数
rand(min, max),获得包括min、max在内的其范围内的随机整数
3.双引号
双引号内$array[$index]的形式有效,比如$str[0] = "A"; print "$str[0]";
4.php sleep
sleep(秒)
usleep(微秒)
5.microtime()
返回msec sec,比如0.25139300 1138197510,都以秒为单位
6.连接处理相关
连接状态: 0-NORMAL(正常) 1-ABORTED(异常退出) 2-TIMEOUT(超时)
当客户端退出或者php中断超时后,php会被通过调用关闭触发函数强制退出
相关函数:
int ignore_user_abort ( [bool setting] )
This function sets whether a client disconnect should cause a script. to be aborted. It will return the previous setting and can be called without an argument to not change the current setting and only return the current setting.
int connection_aborted ( void )
Returns TRUE if client disconnected.
int connection_status ( void )
Returns the connection status bitfield.
7.时区设置
比如,date_default_timezone_set('UTC');
8.设置报错级别
比如,error_reporting(E_ALL);
9.设置php.ini中选项值
比如,ini_set('display_errors', 'on');
10.字符串分割
explode(separator,string,limit);
比如,explode(" ",$str)
原文地址:https://www.cnblogs.com/ketmales/p/2947202.html