Home php教程 php手册 关于PHP5.4的htmlspecialchars

关于PHP5.4的htmlspecialchars

Jun 13, 2016 am 10:50 AM
gbk htmlspecialchars php5.4 about upgrade of coding project

今天项目升级到php5.4,gbk编码,htmlspecialchars转换后的字符串为空,郁闷啊

解决,加上编码吧,这么多地方用到htmlspecialchars,改起来真麻烦,看来以后得自己封装一下了。


UPGRADING说到
[html]
- the default character set for htmlspecialchars() and htmlentities() is 
  now UTF-8. In previous versions it was ISO-8859-1. Note that changing 
  your output charset via the php.ini default_charset directive does not 
  affect htmlspecialchars/htmlentities unless you are passing "" (an  
  empty string) as the encoding parameter to your htmlspecialchars/htmlentities 
  calls.  

手册中也说到

[html] 
string htmlspecialchars ( string $string [, int $flags = ENT_COMPAT | ENT_HTML401 [, string $encoding = 'UTF-8' [, bool $double_encode = true ]]] ) 

[html] 
Defines encoding used in conversion. If omitted, the default value for this argument is ISO-8859-1 in versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards.  


作者:xanxng
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 Article Tags

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)

Several methods for upgrading Python version in Conda Several methods for upgrading Python version in Conda Feb 18, 2024 pm 08:56 PM

Several methods for upgrading Python version in Conda

Can AI conquer Fermat's last theorem? Mathematician gave up 5 years of his career to turn 100 pages of proof into code Can AI conquer Fermat's last theorem? Mathematician gave up 5 years of his career to turn 100 pages of proof into code Apr 09, 2024 pm 03:20 PM

Can AI conquer Fermat's last theorem? Mathematician gave up 5 years of his career to turn 100 pages of proof into code

Upgrading numpy versions: a detailed and easy-to-follow guide Upgrading numpy versions: a detailed and easy-to-follow guide Feb 25, 2024 pm 11:39 PM

Upgrading numpy versions: a detailed and easy-to-follow guide

Tutorial on how to solve the problem of being unable to access the Internet after upgrading win10 system Tutorial on how to solve the problem of being unable to access the Internet after upgrading win10 system Mar 27, 2024 pm 02:26 PM

Tutorial on how to solve the problem of being unable to access the Internet after upgrading win10 system

A closer look at PyCharm: a quick way to delete projects A closer look at PyCharm: a quick way to delete projects Feb 26, 2024 pm 04:21 PM

A closer look at PyCharm: a quick way to delete projects

How to upgrade wps version? How to update the version of wps office? How to upgrade wps version? How to update the version of wps office? Mar 14, 2024 am 08:43 AM

How to upgrade wps version? How to update the version of wps office?

Detailed explanation of how to upgrade Honor mobile phones to Hongmeng system Detailed explanation of how to upgrade Honor mobile phones to Hongmeng system Mar 25, 2024 am 11:51 AM

Detailed explanation of how to upgrade Honor mobile phones to Hongmeng system

PyCharm Practical Tips: Convert Project to Executable EXE File PyCharm Practical Tips: Convert Project to Executable EXE File Feb 23, 2024 am 09:33 AM

PyCharm Practical Tips: Convert Project to Executable EXE File

See all articles