php实现替换UTF
批量去除BOM的程序
function
replace_utf8bom(
$str
)
{
$charset
[1] =
substr
(
$str
,0,1);
$charset
[2] =
substr
(
$str
,1,1);
$charset
[3] =
substr
(
$str
,2,1);
if
(ord(
$charset
[1]) == 239 && ord(
$charset
[2]) == 187 && ord(
$charset
[3]) == 191)
{
return
substr
(
$str
,3);
}
else
{
return
false;
}
}
很明显,这就是前面三个字符是固定的原因,当然可以这样判断了。。。说白了很简单,但如果不知道就真的很痛苦了。顺便说一下,它来自:http://www.phptext.net/technology.php?vid=53
相关文档:
PHP Security for Deployers
If you're a Developer
READ THIS and then work with your SysAdmins to step through any and all the layers of security designed to protect your apps.
Example:
Traffic must first pass through a SPI firewall (ensure that ONLY necessary ports/protocols are permitted; en ......
1、数组的申请和使用:
$array=array(array(2,324,34));
echo $array[0][1];
直接申请使用:
$student[0][0]="我";
$student[0][1]="是";
$student[1][0]="谁";
$student[1][1]="维";
echo $student[1][0];
2、遍历: ......
<?
$_mysqlhost="localhost";
$_mysqluser="root";
$_mysqlpass="";
$_mysqldata="mydata";
$_connect=mysql_connect($_mysqlhost,$_mysqluser,$_mysqlpass) or die ("错误".mysql_error());
mysql_query("SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary", $ ......
<?
include 'conn.php';
$_pagenob=10; //每页规定的信息数目
//获取当前页
if(isset($_GET["page"]))
{
$_page = intval( $_GET['page'] );
}
else
{
$_page=1;
}
//查询数据总数
$_query="select count(*) as acount from news";
$_result=mysql_query($_query);
$_row=mysql_fetch_row($_result);
......
在windows操作系统配置PHP环境,可以用IIS做应用服务器,也可以使用Apache做应用服务器。本文介绍在Windows XP操作系统下配置PHP和Apache环境。
准备工作:
1、在http://windows.php.net/download/下载PHP程序包,因为用Apache做应用服务器,选择用VC6编译的 ......