Home PHP Framework YII Solution to garbled code problem in yii2 console

Solution to garbled code problem in yii2 console

Jul 20, 2020 am 10:53 AM
console yii2

yii2 The solution to console garbled characters: first find and open the corresponding script file; then modify the code statement to "$content = iconv("utf-8","gb2312//IGNORE",$content); ”; finally save the changes.

Solution to garbled code problem in yii2 console

Solution to the problem of Chinese garbled characters normally encountered on the cmd command prompt when Yii2 console executes a scheduled script [Version 2.0]

Specific question:

$content="你好,世界";
$content = iconv("utf-8","gb2312//IGNORE",$content);
echo $content . "\n";
Copy after login

Normally the method we use is this:$data=iconv("GB2312", "UTF-8",$string);

Filtering errors Yes: //IGNORE

Recommended: "yii tutorial"

##Correct usage :

$content = iconv("utf-8","gb2312//IGNORE",$content);
Copy after login

The above is the detailed content of Solution to garbled code problem in yii2 console. For more information, please follow other related articles on the PHP Chinese website!

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

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.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

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)

Pre-orders open for new Nintendo Switch Lite refresh Pre-orders open for new Nintendo Switch Lite refresh Jun 29, 2024 am 06:49 AM

Nintendo has opened pre-orders for the latest version of the Switch Lite (curr. $189.99 on Amazon). However, the device is not available to order globally just yet. To recap, the company presented the Switch Lite Hyrule Edition almost two weeks ago d

What does console mean? What does console mean? Sep 05, 2023 pm 02:43 PM

Console means console. It is a device or software that interacts with a computer system. It is usually a device with a keyboard and a screen for inputting and outputting information. The console was originally Used for large computer systems, and later also applied to personal computers and servers, it can help users manage and maintain computer systems, as well as install operating systems and applications, debug programs, etc.

Clear console output using Console.Clear function in C# Clear console output using Console.Clear function in C# Nov 18, 2023 am 11:00 AM

Use the Console.Clear function in C# to clear the console output. In C# console applications, we often need to clear the output information in the console in order to display new content or provide a better user experience. C# provides the Console.Clear function to implement this function, which can clear the output in the console and make the interface blank again. The calling format of the Console.Clear function is as follows: Console.Clear(); This function does not require any input

Nintendo announces new Switch Lite refresh before Switch 2 release Nintendo announces new Switch Lite refresh before Switch 2 release Jun 20, 2024 am 09:41 AM

Nintendo presented plenty of games yesterday during its most recent Nintendo Direct event, an overview of which we have provided separately. Additionally, the company also announced a new version of the Switch Lite (curr. $194.93 on Amazon), possibly

what does console mean what does console mean Aug 09, 2023 pm 04:21 PM

A console is a console, an interactive interface used in computer programs to input and output text or commands. In different operating systems and development environments, the console may have different appearances and functions. Usually a text interface that provides a command line interface or command line prompt, allowing the user to enter commands through the keyboard and display the output of the program.

MagicX XU Mini M: Teardown reveals RK3326 CPU instead of advertised RK3562, MagicX severs ties with 3rd-party dev MagicX XU Mini M: Teardown reveals RK3326 CPU instead of advertised RK3562, MagicX severs ties with 3rd-party dev Sep 01, 2024 am 06:30 AM

If you purchased the MagicX XU Mini M recently, this news might come as a surprise. A hardware and software teardown of the newly released handheld console revealed that the advertised RK3562 CPU is, in fact, a lower-specced, older RK3326 processor.

How to remove jquery in yii2 How to remove jquery in yii2 Feb 17, 2023 am 09:55 AM

How to remove jquery from yii2: 1. Edit the AppAsset.php file and comment out the "yii\web\YiiAsset" value in the variable $depends; 2. Edit the main.php file and add the configuration "'yii" under the field "components" \web\JqueryAsset' => ['js' => [],'sourcePath' => null,]," to remove the jquery script.

What is the console interface? What is the console interface? Aug 08, 2023 am 11:15 AM

The console interface is a tool for outputting information in the computer command line or browser development tools. It provides a simple way to record and view the output results and debugging information of the application. By using the console interface, developers can identify and solve problems more effectively, optimize application performance, and improve development efficiency. Whether in the command line or browser development tools, the console interface is an indispensable tool.

See all articles