zoukankan      html  css  js  c++  java
  • 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)
  • 相关阅读:
    .JDBC访问数据库的基本步骤是什么?
    文本的四种编码方式
    实现不在栈中产生对象
    字符串链接和复制
    堆和栈的区别(详细)
    产生随机数字
    利用返回引用来操作结构体
    inline 内联函数可以避免函数重定义问题
    五大内存分区,堆与栈的区别(转)
    Strategy模式
  • 原文地址:https://www.cnblogs.com/ketmales/p/2947202.html
Copyright © 2011-2022 走看看