PHP完小(2)

WBOY
Release: 2016-06-13 12:15:26
Original
836 people have browsed it

PHP小学(2)

1.年月日,时分秒

<?phpecho date(DATE_ATOM)."<br/>";echo DATE_ATOM."<br>";?>
Copy after login

2.include可能产生警告但会继续执行,require可能产生致命错误

<?phpecho date(DATE_ATOM)."<br/>";echo DATE_ATOM."<br>";?>
Copy after login


3.文件读写,之注意权限

<?php $f = fopen("/home/tmp/profile.ini", "a+");echo "error_get_last".print_r(error_get_last());$str = date(DATE_ATOM)." this is time IP".$_SERVER[&#39;REMOTE_ADDR&#39;]."\r\n";fwrite($f, $str, strlen($str));fclose($f);$f = fopen("/home/tmp/grep.man", "r");echo "error_get_last".print_r(error_get_last());while(!feof($f)){<span style="white-space:pre">	echo fgets($f);}fclose($f);?>
Copy after login
可以查看目录权限 ls -l

同时观察当前httpd(apache进程)为何用户在执行: ps -aux | grep  httpd

然后改为响应权限即可:chown

4.

setcookie()必须位于之前,默认是30天,单位是秒


5.

session_start需要在需要使用session的php中都调用

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template