PHP file for Windows 7 PHP 7.1 command line execution in Chinese file name

Source: Internet
Author: User

Direct execution in the PHP5.6 era

Php.exe file. php

That's not the problem

The Active code page command in the command line under win

Chcp

Modify

CHCP 936//GBK

CHCP 65001//utf-8

But executing php.exe under PHP 7.1 will first modify the command line's active code page

This is an automatic behavior program that comes with a chcp 65001 then your PHP file

When passed as a parameter if there is a Chinese character so sorry the program is garbled inside

Can't find the file on this issue in Baidu search almost no solution so in the PHP official website

Bug Feedback inside this page

https://bugs.php.net/bug.php?id=73716&edit=2

Probably in [2016-12-12 21:30 UTC] [email protected]

Solution:

Open PHP.ini Search internal_encoding and change to internal_encoding = "cp936"

default_charset= "UTF-8" should be the default, if not, add

This corresponds to the simplified Chinese Windows environment but the disadvantage of this scheme is that it is very dead.

If PHP is packaged and released, it's probably only possible to do it in a simple system.

After changing this, the PHP file is still written in UTF-8 code.

But the input path as a parameter is the contents of the ARGV variable remember to transcode into UTF-8

PHP file for Windows 7 PHP 7.1 command line execution in Chinese file name

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.