我想在使用codeigniter框架的网页中使用urdu?

时间:2016-12-14 14:30:39

标签: php html codeigniter webpage urdu

我正在使用codeigniter框架中的urdu开发一个网站。我想加载 urdu在我的网页上,但我每次都失败了。 当我尝试访问urdu数据并在网页中显示它时,我将urdu发送到uni代码数据库,它向我展示了一些其他的附件。 This is screenshot of webpage

我已经在下面使用了元标记

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

如何使用codeigniter框架在网页中编写urdu。

1 个答案:

答案 0 :(得分:3)

步骤:1 - 转到表格结构并将归类 latin1_swedish_ci 更改为 utf8_general_ci

步骤:2 - 您必须在数据结果页面中包含以下标记。

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

步骤:3 - 插入'N'前缀。这里N代表国家语言字符集。这意味着您传递的是NCHAR,NVARCHAR或NTEXT值

步骤:4 - 显示数据库记录的PHP代码。在此之前,您必须指定mysql_query()函数数据字符集类型

<?php
include('db.php');
mysql_query ("set character_set_results='utf8'"); 
$query = mysql_query("SELECT * FROM books") or die(mysql_error());
while($row=mysql_fetch_array($query))
{
echo $row['id']; // Book id 
echo $row['books_title']; // Book title
}
?>