php include文件后多出一空白行
用多种编辑软件修改过的php网站可能会遇到一很怪问题:用include引入的footer和header文件都在上面多出一空白行,直接把被引入的文件放入则没问题。这个问题极有可能是编码问题引起的。如果采用utf-8编码要设置为无bom,并且要所有的涉及到的页面包括css及其他文件都要以无bom的utf-8编码。具体方法可以是:在Dreamweaver里 点“修改”,选择“页面属性”,“标题/编码”,把 包括unicode签名(bom) 的勾取消。
相关文档:
最近想安装PEAR(PHP Extension and Application Repository),但是在执行批处理文件go-pear.bat的时候出现了错误:
phar "C:\php\PEAR\go-pear.phar" does not have a signature
PHP Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar error: ......
<?
@session_start();
$counter = intval(file_get_contents("counter.dat"));
if(!$_SESSION['jingyun'])
{
$_SESSION['jingyun'] = true;
$counter++;
$fp = fopen("counter.dat","w");
fwrite($fp, $counter);
fclose($fp);
}
?>
总访问 <span style="font-size:14px; color:#FF6600" mce_sty ......
htmlspecialchars()
函数把一些预定义的字符转换为 HTML 实体。
ENT_COMPAT - 默认。仅编码双引号。
eg:" (双引号) 成为 "
implode()
函数把
数组元素组合为一个字 ......
session是网站保存用户信息的一种手段,应用相当广泛。例如第五届排行榜就使用了session。经过对第五届排行榜的修改,我总结了一下php中session的用法。
(一)开始session
在每一次使用session之前,都要加上这一句:“session_start();”。顾名思义,这个函数的作用就是开始使用session。
(二)注 ......
在head.htm中加入,也就是在默认模版中添加“$stime=microtime(true); //获取程序开始执行的时间”
句
<!--<?php
$stime=microtime(true); //获取程序开始执行的时间
$GuideFid[$fid]=str_replace("<a href='$webdb[www_url]' class='guide_menu'>>首页</a>","",$GuideFid[$fid]);
$f ......