国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Table of Contents
回復討論(解決方案)
Home Backend Development PHP Tutorial smarty模板 display的頁面輸出亂碼

smarty模板 display的頁面輸出亂碼

Jun 23, 2016 pm 01:50 PM
display smarty Garbled characters template output

我的數(shù)據(jù)庫使用的是gb2312,而用smarty輸出出來的卻是亂碼,如果還需要詳細???我在補充


回復討論(解決方案)

從數(shù)據(jù)庫讀取數(shù)據(jù)時,要聲明與你頁面編碼一致的字符集

數(shù)據(jù)編碼,文件編碼,要一致,看一下你的文件編碼,數(shù)據(jù)庫編碼,

數(shù)據(jù)編碼,文件編碼?一致就可以了,跟SMARTY沒有半毛錢關系

如果不用smarty的話,一切正常,付上各個文件和數(shù)據(jù)庫的圖

亂碼在哪??你的index.html?是gbk編碼嗎?

嗯,我全部都是用gbk的,但是還是有亂碼,我在貼2個圖,在index.html中用smarty模板中寫的是
在瀏覽器中顯示的是

數(shù)據(jù)庫中keyword表中的情況是

在PHP中print_r($row);?亂碼嗎

header("Content-Type:?text/html;?charset=gb2312");

不會亂碼,如圖

$s?=?file_get_contents('你的url‘);
echo?base64_encode($s);

貼出結果

我把模板頁面考到index.php下,但是出現(xiàn)了不能保存

貼出結果:

我要你貼出的是文本,不是截圖

你這是拿人開心?
聲明?utf-8?字符集,卻使用?gbk?字符

我沒有聲明utf-8呀,奇怪的就是要怎么解決這個問題,你看我前面貼出來的那些文件,我什么地方用到utf-8了,我就奇怪沒有用到,為什么還會是utf-8

#14?的截圖不就是嗎?
再說,你只是聲明為?gb2312?但文件卻是按有BOM的utf-8保存的

同樣的文件,我把你讓我加的那段代碼刪了,如圖:

查看文本如圖,是gbk

檢查一下軟件編輯器的設置。

那我要怎么才能做到gbk保存,這個真心不懂啊,求指教

算了,我全部改成utf-8吧,謝謝大家

編輯器的編碼設置都不會了哇。。。神奇

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1502
276
Fujifilm X-M5 price expectations rise as leaked selfie display adds complexity to the formerly affordable camera line Fujifilm X-M5 price expectations rise as leaked selfie display adds complexity to the formerly affordable camera line Sep 07, 2024 am 09:34 AM

Fujifilm fans were recently very excited at the prospect of the X-T50, since it presented a relaunch of the budget-oriented Fujifilm X-T30 II that had become quite popular in the sub-$1,000 APS-C category. Unfortunately, as the Fujifilm X-T50's launc

How to solve the problem of garbled characters when importing Chinese data into Oracle? How to solve the problem of garbled characters when importing Chinese data into Oracle? Mar 10, 2024 am 09:54 AM

Title: Methods and code examples to solve the problem of garbled characters when importing Chinese data into Oracle. When importing Chinese data into Oracle database, garbled characters often appear. This may be due to incorrect database character set settings or encoding conversion problems during the import process. . In order to solve this problem, we can take some methods to ensure that the imported Chinese data can be displayed correctly. The following are some solutions and specific code examples: 1. Check the database character set settings In the Oracle database, the character set settings are

How to deal with garbled characters in Linux terminal How to deal with garbled characters in Linux terminal Mar 20, 2024 pm 03:12 PM

How to deal with the problem of garbled characters in the Linux terminal. When using the Linux system, sometimes the text displayed in the terminal will be garbled. This brings inconvenience to us when using the terminal and needs to be dealt with in time. This article will introduce how to deal with some common Linux terminal garbled problems, and provide specific code examples. Problem 1: Garbled Chinese characters on the terminal. Garbled Chinese characters on the terminal are usually caused by incorrect character encoding settings on the terminal. We can solve this problem by modifying the terminal's character encoding settings. #View the current terminal

Strategies and techniques for solving Chinese garbled characters in Oracle database Strategies and techniques for solving Chinese garbled characters in Oracle database Mar 08, 2024 am 09:48 AM

Strategies and techniques for solving Chinese garbled characters in Oracle database. In actual database applications, many developers or administrators may encounter the problem of Chinese garbled characters in Oracle database. When the data in the database is garbled, it not only affects the correctness and readability of the data, but also brings many problems to the system. This article will combine specific code examples to introduce the strategies and techniques for solving Chinese garbled characters in Oracle database to help readers better understand and solve this problem. 1. The reason for garbled characters is inconsistent character sets: database connection and application

Google Pixel 9 Pro XL ranks 2nd in DxOMark\'s \'Global\' smartphone camera ranking Google Pixel 9 Pro XL ranks 2nd in DxOMark\'s \'Global\' smartphone camera ranking Aug 23, 2024 am 06:42 AM

Google's new Pixel 9 series has introduced a new variant that wasn't present in previous lineups, the Pixel 9 Pro XL. It is essentially identical to the non-XL variant (pre-order at Amazon), but as the name suggests, it has a larger screen. The two e

How to add PPT mask How to add PPT mask Mar 20, 2024 pm 12:28 PM

Regarding PPT masking, many people must be unfamiliar with it. Most people do not understand it thoroughly when making PPT, but just make it up to make what they like. Therefore, many people do not know what PPT masking means, nor do they understand it. I know what this mask does, and I don’t even know that it can make the picture less monotonous. Friends who want to learn, come and learn, and add some PPT masks to your PPT pictures. Make it less monotonous. So, how to add a PPT mask? Please read below. 1. First we open PPT, select a blank picture, then right-click [Set Background Format] and select a solid color. 2. Click [Insert], word art, enter the word 3. Click [Insert], click [Shape]

Effects of C++ template specialization on function overloading and overriding Effects of C++ template specialization on function overloading and overriding Apr 20, 2024 am 09:09 AM

C++ template specializations affect function overloading and rewriting: Function overloading: Specialized versions can provide different implementations of a specific type, thus affecting the functions the compiler chooses to call. Function overriding: The specialized version in the derived class will override the template function in the base class, affecting the behavior of the derived class object when calling the function.

What are the common applications of C++ templates in actual development? What are the common applications of C++ templates in actual development? Jun 05, 2024 pm 05:09 PM

C++ templates are widely used in actual development, including container class templates, algorithm templates, generic function templates and metaprogramming templates. For example, a generic sorting algorithm can sort arrays of different types of data.

See all articles