使用Php Mysql的Unicode/UTF Seo友好Url(slug)
使用此函数+.htaccess将我的Url更改为Seo友好型。我的项目是阿拉伯语使用Php Mysql的Unicode/UTF Seo友好Url(slug),php,mysql,url-rewriting,seo,Php,Mysql,Url Rewriting,Seo,使用此函数+.htaccess将我的Url更改为Seo友好型。我的项目是阿拉伯语 function clean($title) { $seo_st = str_replace(' ', '-', $title); $seo_alm = str_replace('--', '-', $seo_st); $title_seo = strtolower(str_replace(' ', '', $seo_alm)); return $title_seo;} 现在在我的url中,我看到以下内容:
function clean($title) {
$seo_st = str_replace(' ', '-', $title);
$seo_alm = str_replace('--', '-', $seo_st);
$title_seo = strtolower(str_replace(' ', '', $seo_alm));
return $title_seo;}
现在在我的url中,我看到以下内容:
localhost/news/4/�����-��-����-�����-��-����/
有什么问题吗
谢谢检查您的数据库字段
排序规则是否正确设置为UTF-8,以及您的连接是否为UTF-8设置名称“utf8”
如果在脚本中使用值中的任何字符,请确保它们也是UTF-8。在执行任何其他操作之前,请在代码中尝试此操作,并告诉我它是否有效:
mb_internal_encoding("UTF-8");
mb_regex_encoding("UTF-8");
试试这个
$dbconnect = @mysql_connect($server,$db_username,$db_password);
$charset = @mysql_set_charset('utf8',$dbconnect);
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
</head>
$dbconnect=@mysql\u connect($server、$db\u username、$db\u password);
$charset=@mysql\u set\u charset('utf8',$dbconnect);
试试看。。。它对我有用
在我的配置中:mysql\u查询(“设置名称'utf8'”);我的排序规则是:utf8\u波斯语\u ciDebug您的链,然后找出字符何时损坏。已在配置文件中。我将所有UTF-8代码都放在配置文件中。但我不知道有什么问题。