阿拉伯语元标签
我试图显示阿拉伯语元标记,但是当我加载页面并查看源代码时,它会显示一些垃圾。
这是我的 config.php 文件
define("GAMES_META_DESCRIPTION", "بيسبي");
,这是我的头文件,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ar" xml:lang="ar">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<meta http-equiv="Content-Language" content="ar-sy">
<meta name="description" content="<?=htmlentities($meta_description);?>">
</head>
任何帮助都会得到 cookie 的奖励:)
I am trying to show an Arabic meta tags, but when ever I load the page, and I view the source it shows some garbage.
This is my config.php file
define("GAMES_META_DESCRIPTION", "بيسبي");
and this is my header file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ar" xml:lang="ar">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<meta http-equiv="Content-Language" content="ar-sy">
<meta name="description" content="<?=htmlentities($meta_description);?>">
</head>
any help with be rewarded with a cookie :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您是否尝试使用纯阿拉伯字符而不是使用函数
例如
元名称=“描述”内容=“巴塞巴”
可能问题在于您的函数本身而不是编码。
Did you try using plain arabic characters instead of using a function
e.g
meta name="description" content="بيسب"
probably the problem is in your function itself not encoding.
确保您的 PHP 和头文件采用相同的编码。最好是UTF-8。
Make sure that both your PHP and your header files are the same encoding. Preferably UTF-8.
好的,我不知道您需要什么元描述?它没有用。无论如何我推荐使用UTF8。文件必须保存为 utf8 和 meta:
ok I don't know for what you need meta description? it is not useful. Anyway I recommend use UTF8. file have to be saved as utf8 and meta:
我同意。使用:
在
/>
之前使用双引号和一个空格(我知道我很挑剔,但据我所知,这是标准方法。)使用 UTF-8 的一个好处是您几乎不需要用 HTML 实体(在 å 的情况下,
å
)替换特殊字符,例如瑞典语字母 å。另外,我不同意上面的评论,即元描述没有用。相反,我发现元描述非常有用,主要是因为它们在谷歌搜索结果中经常出现。
I agree. Use:
With double quotes and a space before
/>
(I know I'm picky, but that's as far as I know the standard way to do it.)One upside with using UTF-8 is that you almost never have to replace special characters, like the Swedish letter å, with HTML entites (in the case of å,
å
).Also, I disagree with the comment above that meta descriptions aren't useful. On the contrary, I find meta descriptions very useful, mainly because they appear often enough in results from google searches.
尝试在页面顶部的任何 html 之前打开输出缓冲,
并且在代码的底部,
它将使 cookie 与元一起工作。
输出缓冲非常有帮助
Try to open output buffering in the top of the page before any html
and in the bottom end of your code
it will make cookie work with meta.
Output buffering is very helpful with