Can';t在php脚本中以utf8格式查看文本
我有一个用于房地产的脚本,它包含一个用于翻译的区域设置文件,我翻译了它,但文本显示为问号。。。尝试了下列方法但没有成功Can';t在php脚本中以utf8格式查看文本,php,encoding,utf-8,wamp,Php,Encoding,Utf 8,Wamp,我有一个用于房地产的脚本,它包含一个用于翻译的区域设置文件,我翻译了它,但文本显示为问号。。。尝试了下列方法但没有成功 添加 头内元件 将AddDefaultCharset utf-8添加到.htaccess 将AddDefaultCharset utf-8添加到httpd.ini 将这些行添加到php.ini default\u charset=“utf-8” mbstring.internal_encoding=utf-8 mbstring.http\u输出=UTF-8 mbstring
- 添加
头内元件 - 将
添加到.htaccessAddDefaultCharset utf-8
- 将
添加到httpd.iniAddDefaultCharset utf-8
- 将这些行添加到php.ini
default\u charset=“utf-8”
mbstring.internal_encoding=utf-8
mbstring.http\u输出=UTF-8
mbstring.encoding\u translation=On
mbstring.func\u重载=6
确保用于保存这些文件的编辑器正在将文件写入UTF-8 您还可以尝试将文本转换为UTF-8
$utf8_text = mb_convert_encoding($non_utf8, 'UTF-8', mb_detect_encoding($non_utf8));
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<?php
if (!isset($_GET['iframe']))
{
$content = ob_get_contents();
ob_end_clean();
ob_start();
}
if (!isset($_GET['controller']) || empty($_GET['controller']))
{
$_GET["controller"] = "Listings";
}
if (!isset($_GET['action']) || empty($_GET['action']))
{
$_GET["action"] = "index"
include dirname(__FILE__) . '/index.php';
if (!isset($_GET['iframe']))
{
$app = ob_get_contents();
ob_end_clean();
$app = str_replace('$','$',$app);
echo preg_replace('/\{APP_TPL\}/', $app, $content);
}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<?php
ob_start();
?>
<!doctype html>
<html>
<head>
<title>Property Listing</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
</head>
<body>
{APP_TPL}
</body>
</html>
<?php include 'listings.php'; ?>
#Login
$PL_LANG['login_login'] = 'Admin login';
$PL_LANG['login_username'] = "المستخدم";
$PL_LANG['login_password'] = "كلمة السر";
$PL_LANG['login_login'] = "Admin Login";
$PL_LANG['login_register'] = "تسجيل";
$PL_LANG['login_err'][1] = "Wrong username or password";
$PL_LANG['login_err'][2] = "Access denied";
$PL_LANG['login_err'][3] = "Account is disabled";
$PL_LANG['login_error'] = "Error";
# Left menu
$PL_LANG['menu_home'] = "Home";
$PL_LANG['menu_properties'] = "Properties";
$PL_LANG['menu_options'] = "Options";
$PL_LANG['menu_install'] = "Install";
$PL_LANG['menu_preview'] = "Preview";
$PL_LANG['menu_logout'] = "Logout";
$PL_LANG['menu_users'] = "Users";
# General
$PL_LANG['_yesno']['T'] = "Yes";
$PL_LANG['_yesno']['F'] = "No";
$utf8_text = mb_convert_encoding($non_utf8, 'UTF-8', mb_detect_encoding($non_utf8));