PHP learning 1# - 安装、配置

来源:互联网 发布:k mean聚类算法 编辑:程序博客网 时间:2024/06/01 10:52

1、php.ini 配置

 

     display_errors = On

 

     error_reporting=E_ALL & ~E_NOTICE

 

          E_ALL & ~E_NOTICE  (Show all errors, except for notices and coding standards warnings.)
          E_ALL & ~E_NOTICE | E_STRICT  (Show all errors, except for notices)
          E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR  (Show only errors)
          E_ALL | E_STRICT  (Show all errors, warnings and notices including coding standards.)

 

      比如:变量未初始化,就会在页面显示Notice: Undefined variable:这样的提示,随不影响功能,但是页面显示就会出错。

 

      date.timezone=Europe/Berlin(default)

 

        修改为:Asia/Chongqing ,Asia/Shanghai ,Asia/Urumqi或者PRC

 

2、php乱码

 

     ----显示????

 

     1) 网页文件head设置编码<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     2) PHP页面在保存的时候使用utf-8编码保存,可以用记事本,UE,convertz802等转换文件
     3) 在MYSQL中新建数据库的时候数据库 选择UTF-8编码既字符集 设定为 utf-8_unicode_ci(Unicode (多语言), 不区分大小写),
        库里面 表table的 整理 设置为 utf-8_general_ci
        表里面的每个字段的 整理 都设置为 utf-8_general_ci

 

        可以用Alter 修改,或者用可视化工具修改(属性中设置),修改后保存重启。       

 

     4) 在PHP连接数据库的时候,也就是mysql_connect()之后加入

           mysql_query("set names ’utf8’ "); 
         //  mysql_query("set character_set_client=utf8"); 
         // mysql_query("set character_set_results=utf8");