阿拉伯语元标签

发布于 2024-09-24 03:21:43 字数 660 浏览 1 评论 0原文

我试图显示阿拉伯语元标记,但是当我加载页面并查看源代码时,它会显示一些垃圾。

这是我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

江南烟雨〆相思醉 2024-10-01 03:21:43

您是否尝试使用纯阿拉伯字符而不是使用函数
例如
元名称=“描述”内容=“巴塞巴”

可能问题在于您的函数本身而不是编码。

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.

┊风居住的梦幻卍 2024-10-01 03:21:43

确保您的 PHP 和头文件采用相同的编码。最好是UTF-8。

Make sure that both your PHP and your header files are the same encoding. Preferably UTF-8.

灼痛 2024-10-01 03:21:43

好的,我不知道您需要什么元描述?它没有用。无论如何我推荐使用UTF8。文件必须保存为 utf8 和 meta:

<meta http-equiv='content-Type' content='text/html; charset=UTF-8'/>

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:

<meta http-equiv='content-Type' content='text/html; charset=UTF-8'/>
素年丶 2024-10-01 03:21:43

我同意。使用:

<meta http-equiv="content-Type" content="text/html; charset=UTF-8" />

/> 之前使用双引号和一个空格(我知道我很挑剔,但据我所知,这是标准方法。)

使用 UTF-8 的一个好处是您几乎不需要用 HTML 实体(在 å 的情况下,å)替换特殊字符,例如瑞典语字母 å。

另外,我不同意上面的评论,即元描述没有用。相反,我发现元描述非常有用,主要是因为它们在谷歌搜索结果中经常出现。

I agree. Use:

<meta http-equiv="content-Type" content="text/html; charset=UTF-8" />

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.

时光是把杀猪刀 2024-10-01 03:21:43

尝试在页面顶部的任何 html 之前打开输出缓冲,

<?php ob_start(); ?>

并且在代码的底部,

<?php ob_end_flush(); ?>

它将使 cookie 与元一起工作。

输出缓冲非常有帮助

header("location:anyPage.php") 

Try to open output buffering in the top of the page before any html

<?php ob_start(); ?>

and in the bottom end of your code

<?php ob_end_flush(); ?>

it will make cookie work with meta.

Output buffering is very helpful with

header("location:anyPage.php") 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文