参考phpinfo的信息,iconv模块也已经正确加载。
google一下。原来才知道,原来在linux版本下iconv这个方法还是有点下下问题的。
csdn上的一个网友给出的解决方案为:
一种方法是把iconv换成 mb_convert_encoding
另一种方法是修改iconv 的实现,从glibc 改为libiconv
搞了半天,烦躁!
有朋友碰到的话,也可以这么解决了
按照该网友提供的第一个方法,将iconv方法修改为使用mb_convert_encoding,搞定。。
多谢该网友提供的解决方案。
XmlDocument 创新对象时, 产生 xmlns= 的解决方案
1. 读取时,应该添加NameSpace.
smarty 多级分类实现方法
运行结果
网址字符串转换成超级链接PHP代码
php cookie登录验证代码
<html>
<head>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<form name="form1" method="post" action="login.php">
<table width="300" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td width="150"><div align="right">用户名:</div></td>
<td width="150"><input type="text" name="username"></td>
</tr>
<tr>
<td><div align="right">密码:</div></td>
<td><input type="password" name="passcode"></td>
</tr>
<tr>
<td><div align="right">Cookie保存时间:</div></td>
<td><select name="cookie" id="cookie">
<option value="0" selected>浏览器进程</option>
<option value="1">保存1天</option>
<option value="2">保存30天</option>
<option value="3">保存365天</option>
</select></td>
</tr>
</table>
<p align="center">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
</p>
</form>
</body>
</html>
PHP 文件与目录删除程序
function RmDirFiles($indir)
{
$dh = dir($indir);
while($filename = $dh->read()) {
if($filename == "." || $filename == "..")
continue;
else if(is_file("$indir/$filename"))
@unlink("$indir/$filename");
else
$this->RmDirFiles("$indir/$filename");
}
$dh->close();
@rmdir($indir);
}
phpthink中字符串截取代码-支持中文和其它编码
经典php批量上传源码
html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function Check(){
//alert('dddd');
for(i=1; i<9; i++){
if(document.getElementById('v'+i).value == ''){
document.getElementById('v'+i).name = 'uu';
}
}
}
php mysql数据库连接类
class mysql {
private $db_host; //数据库主机
private $db_user; //数据库用户名
private $db_pwd; //数据库用户名密码
private $db_database; //数据库名
private $conn; //数据库连接标识;
private $result; //执行query命令的结果资源标识
private $sql; //sql执行语句
private $row; //返回的条目数
private $coding; //数据库编码,GBK,UTF8,gb2312
private $bulletin = true; //是否开启错误记录
private $show_error = true; //测试阶段,显示所有错误,具有安全隐患,默认关闭
private $is_error = false; //发现错误是否立即终止,默认true,建议不启用,因为当有问题时用户什么也看不到是很苦恼的
php无限级分类程序
<?php
$a = array(
'AAAAAA' => array(
'aaaaaa' => array(
'111111',
'222222',
'333333'
),
'bbbbbb' => array(
'111111',
'222222',
'333333'
),
'cccccc' => array(
'111111',
'222222',
'333333'
),
),
'BBBBBB' => array(
'aaaaaa' => array(
'111111',
'222222',
'333333'
),
'bbbbbb'=> array(
'111111',
'222222',
'333333'
),
'cccccc'=> array(
'111111',
'222222',
'333333'
),
),
'CCCCCC' => array(
'aaaaaa'=> array(
'111111',
'222222',
'333333'
),
'bbbbbb'=> array(
'111111',
'222222',
'333333'
),
'cccccc' => array(
'111111',
'222222',
'333333'
),
),
);
php下载css中图片代码
<?php教程
$url = 'http://www.phprm.com';
$data = file_get_contents('abc.css教程');
preg_match('/(.*//.*?)//',$url,$host);
$host = $host[1];
if (!is_dir('img')) { mkdir('img'); }
$regex = '/url('http://pic2.phprm.com/2011/09/26/{0,1}"{0,1}(.jpg)/';
preg_match_all($regex,$data,$result);
foreach ($result[1] as $val) {
if (preg_match('/^http.*/',$val)) { $target = $val; }
else if (preg_match('/^/.*/',$val)) { $target=$host.$val; }
else { $target=$url.$val; }
echo $target."<br/>rn";
preg_match('/.*/(.*.D+)$/',$val,$name);
if (!is_file('./img/'.$name[1])) {
copy($target,'./img/'.$name[1]);
}
}?>
php 递归遍历文件树代码
> ../b.php教程 和 ../a.php,结果就会在扫描报告上面出现两次,很是奇怪。