time zone问题
PHP Warning: date(): It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still gett
ing this warning, you most likely misspelled the timezone identifier. We selected ‘UTC’ for ‘UTC’
solotion:
1.
在页面头部加入以下语句
date_default_timezone_set(“PRC”);
2.
在php.ini里找到date.timezone这行,把值改成UTC,如date.timezone = UTC。
数据库存储value的问题
构造array的时候
1.表单数据验证
$save[“name”] = form_input_validate($name, “name”, “”, false, 3);
2.int类型数据的强转
$save[“num”] = intval(form_input_validate($num, “num”, “”, false, 3));
3.sql的净化
$array_items[$key] = sql_sanitize($value);
removes and quotes unwanted chars in values passed for use in SQL statements
pear
Pear的作用:可以方便的安装PHP Extensions
1.wget http://pear.php.net/go-pear.phar
2.php go-pear.phar
pear : /bin/pear
/usr/local/bin/php/paer
cd /share/pear包的位置
开源的php技术
- drupal 内容管理系统
- phpBB 论坛
- wordpress 博客
- coppermine gallery 控制照片
常用function
- explode(separator,string,limit)
- microtime();
- list();
- chdir();
- isset()函数测试变量是否存在(是否已经赋值)
- empty()函数测试是否包含一个空值(php中空值包括0,空串,或false及NULL的值)
- $SERVER[‘PHP_SELF’]存储了当前脚本的名字
- 上传文件绝对路径
define(‘ROOT’,dirname(FILE).’/’);
target=ROOT.GWUPLOADPATH. screenshot; - 正则内置函数
preg_match();
preg_replace();