Archive for the ‘php’ Category

DISCUZ的中文分词for php

星期六, 一月 30th, 2010

需要用中文分词来获取TAG
找了DISCUZ的觉得不错,是在线的,不需要本地的词库

<?php    
 
//强制使用字符集    
 
@header('Content-Type: text/html; charset=gbk');    
 
$subjectenc =$_POST['subject'];
 
 
 
$messageenc = preg_replace($_POST['message']);
 
 
$data = @implode('', file("http://keyword.discuz.com/related_kw.html?title=$subjectenc&content=$messageenc&ics=gbk&ocs=gbk")); 
 
if($data) {    
 
$parser = xml_parser_create();//建立一个 XML 解析器    
 
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);    
 
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);    
 
xml_parse_into_struct($parser, $data, $values, $index);//将 XML 数据解析到数组中    
 
xml_parser_free($parser);    
 
$kws = array();    
 
foreach($values as $valuearray) {    
 
  if(in_array($valuearray['tag'],array('kw','ekw'))) {   //kw ekw是什么意思?    
 
    $kws[] = iconv('utf-8','gbk',$valuearray['value']);//编码转换    
 
   }    
 
}}    
 
//最后出来的是数组.    
 
print_r($kws);    
 
?>

PHP $_FILES数组-标记一下

星期一, 一月 11th, 2010

文件上传表单的处理

 
<form action="http://qlj.sh.cn/post.php" enctype="multipart/form-data" method="post">
<input name="MAX_FILE_SIZE" type="hidden" value="1000" />
<input name="upfile" type="file" />
<input type="submit" value="上传文件" />
</form>

(全文…)

date() [function.date]: It is not safe to rely on the system’s timezone settings

星期二, 九月 29th, 2009

Warning: date() [function.date]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘Asia/Chongqing’ for ‘CST/8.0/no DST’ instead in /home/www/qfclub/user/upimg.php on line 16

(全文…)

php不显示错误信息

星期四, 五月 28th, 2009

centos默认的PHP没有开启错误信息
测试程序的时候就不知道什么问题了

只要简单修改PHP.INI
就可以了
找到
display_errors
改ON

gmdate函数转换时间

星期天, 三月 1st, 2009

time()函数的数值是以秒为记数单位
所以要转换成可查看的时间
gmdate(‘Y-n-j H:i:s’, time() )
显示为
2007-3-20 01:48:23

(全文…)

PHPCMS中RSS订阅无法更新错误

星期一, 二月 2nd, 2009

phpcms订阅的RSS无法更新

发现一重大问题

(全文…)

PHPCMS栏目最大缺陷

星期天, 二月 1st, 2009

发现栏目问题很严重

(全文…)

phpcms2008-分页错误-内容为空

星期六, 十二月 20th, 2008

PHPCMS2008 分页错误

发文章后 TITLE  标题 里是内容

第一页 不显示文章

(全文…)

snoopy

星期六, 八月 23rd, 2008

snoopy是一个php类,用来模仿web浏览器的功能,它能完成获取网页内容和发送表单的任务。

(全文…)

phpcms2007,DIGG文章排行出现非法参数

星期一, 八月 4th, 2008

phpcms2007,DIGG文章排行 出现 非法参数

(全文…)