Home >php教程 >php手册 >PHP小学(2)

PHP小学(2)

WBOY
WBOYOriginal
2016-06-06 19:45:15966browse

1.年月日,时分秒 ?phpecho date(DATE_ATOM).br/;echo DATE_ATOM.br/;? 2.include可能产生警告但会继续执行,require可能产生致命错误 ?php include headerx.php; ??phpecho date(DATE_ATOM).br/;echo DATE_ATOM.br/;? 3.文件读写,之注意权限 ?php$f = fopen(

1.年月日,时分秒

<?php echo date(DATE_ATOM)."<br/>";
echo DATE_ATOM."<br>";

?>

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

<?php echo date(DATE_ATOM)."<br/>";
echo DATE_ATOM."<br>";

?>


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);
?>
可以查看目录权限 ls -l

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

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

4.

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


5.

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

Statement:
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