Home  >  Article  >  Database  >  php-PHP向mysql中写数据变成空格

php-PHP向mysql中写数据变成空格

WBOY
WBOYOriginal
2016-06-06 09:37:461172browse

mysqlphpphpmyadmin数据库数据

function makePage($link)
{
......
//当网址属于xuegong.hubu
else if(strstr($link, 'xuegong.hubu'))
{
$page = curl_init();
curl_setopt($page, CURLOPT_URL , $link);
curl_setopt($page, CURLOPT_RETURNTRANSFER , 1);
$content = curl_exec($page);
$content = stristr($content, 'class="title"');
$content = stristr($content, 'class="bottom"', true);
$content = str_replace('class="title">', '', $content);
$content = strip_tags($content,'');
$content = stristr($content, '责任编辑',true);
$content = trim($content);
$content = str_replace("\r\n", "
", $content);
$content = preg_replace('/(
){2,}/', '
', $content);
$content = str_replace('href="', 'href="http://xuegong.hubu.edu.cn', $content);
return $content;
}
}

$content = mysql_real_escape_string(makePage($notice[1][$key]));
$sql = 'insert ignore into php_notice(title,link,date,content) values("'.$value.'","'.$notice[1][$key].'","'.$notice[2][$key].'","'.$content.'");';
mysql_query($sql) or die(mysql_error());

<code></code>

我是把项目放在sae上面,数据库都连接了,抓取其他网页的内容写入数据库都没问题,但是碰到xuegong的网页写入数据库在PHPMyAdmin查看是空格,图片说明
PHP也没有提示错误,而且将内容打印出来也是对的,就是写入数据库之后变成了空格,编码都是utf-8。不知何解,求教

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