我有一个房地产脚本,它包含一个用于翻译的语言环境文件,我翻译了它,但文本显示为问号......尝试了以下但没有成功
添加
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
头部元素添加
AddDefaultCharset utf-8
到 .htaccess- 添加
AddDefaultCharset utf-8
到 httpd.ini 将此行添加到 php.ini
default_charset = "utf-8"
mbstring.internal_encoding=utf-8
mbstring.http_output=UTF-8
mbstring.encoding_translation=On
mbstring.func_overload=6
以下是一些脚本页面:
index.php(控制面板,这里翻译的文字也是乱码)
<?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'; ?>
清单.php
<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'; ?>
en.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";