草庐IT

mb_encode_numericentity

全部标签

php - FallbackResource 导致 net::ERR_INCOMPLETE_CHUNKED_ENCODING

当我使用仅包含这一行的.htaccess时:FallbackResourceindex.php我只在Chrome上遇到这个错误:net::ERR_INCOMPLETE_CHUNKED_ENCODING只有在访问.htaccess所在的根目录时才会出现该错误。IE,如果.htacess位于www.mysite.org/admin中,则仅当我在导航栏中键入确切的URL时才会出现错误。如果我去www.mysite.org/admin/index.php或www.mysite.org/admin/some-user-friendly-url有没有错误。这个错误真的很烦人,因为它会延迟页面加载几

php - 为什么调用 mb_convert_encoding 来清理文本?

引用this(excellent)answer.他指出,在PHP中转义输入的最佳解决方案是调用mb_convert_encoding其次是html_entities.但为什么要使用相同的传入和传出参数(UTF8)调用mb_convert_encoding?原答案摘录:Evenifyouusehtmlspecialchars($string)outsideofHTMLtags,youarestillvulnerabletomulti-bytecharsetattackvectors.Themosteffectiveyoucanbeistousetheacombinationofmb_co

php - 调用未定义函数 FOS\UserBundle\Util\mb_convert_case()

我遇到了错误CalltoundefinedfunctionFOS\UserBundle\Util\mb_convert_case()app_path/vendor/bundles/FOS/UserBundle/Util/Canonicalizer.phponline18它发生在我尝试加载固定装置时。第一步是安装mbstring.soext,所以我用编译了php--enable-mbstring成功编译mbstringextphpize./configuremakemakeinstall并添加extension=mbstring.so到我的php.ini文件。不幸的是,我仍然遇到该错误,

php - json_encode 创建格式错误的 JSON(带有额外的隐藏字符)

我正在使用PHP的json_encode()返回一些数据,由jQuery的ajax()检索:简化的JS:$.ajax({dataType:'json',contentType:'application/json',cache:false,type:'POST',url:'./api/_imgdown.php',error:function(jqXHR,textStatus,errorThrow){console.log(jqXHR,textStatus,errorThrow);},success:function(data,textStatus,jqXHR){console.log(d

PHP: mb_strtoupper 不工作

我对UTF-8和mb_strtoupper有疑问。mb_internal_encoding('UTF-8');$guesstitlestring='LeCourrierdeSáint-Hyácinthe';$encoding=mb_detect_encoding($guesstitlestring);if($encoding!=='UTF-8')$guesstitlestring=mb_convert_encoding($guesstitlestring,'UTF-8',$encoding);echo"DEBUG1$guesstitlestring\n";$guesstitlestri

php - Json_encode 字符集问题

当我使用json_encode对我的多语言字符串进行编码时,它还会更改特殊字符。我应该怎么做才能使它们保持相同。例如它返回类似["\u015f\u00fc\u011f\u00e7\u00f6"]的内容但我想要["şüğçö"] 最佳答案 尝试一下: 关于php-Json_encode字符集问题,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/3035462/

PHP utf8_encode() 将空格转换为不间断空格

关闭。这个问题需要debuggingdetails.它目前不接受答案。编辑问题以包含desiredbehavior,aspecificproblemorerror,andtheshortestcodenecessarytoreproducetheproblem.这将有助于其他人回答问题。关闭2年前。Improvethisquestion非常简单:utf8_encode($string)将常规空格替换为不间断空格("\u00a0")。我尝试使用str_replace过滤结果:str_replace("\u00a0","",utf8_encode($string))但这并没有解决问题。编辑

php - json_encode 从 MSSQL-SELECT 生成 JSON_ERROR_UTF8

我对mssql的数据库查询有一个恼人的问题。如果结果包含特殊字符,例如德语“ä”,我将无法使用json_encode将结果正确获取为json。json_last_error返回5等于JSON_ERROR_UTF8。我猜数据库不会返回编码为UTF-8的值。数据库集合是*Latin1_General_CI_AS*,受影响的列是varchars。phpmssql.charset配置无效。我读到mysql用户可以使用mysql_query('SETCHARACTERSETutf8');正确编码返回值。我该怎么做才能正确获取mssql的值?提示-我无法更改数据库中的任何内容。

php - 在 PHP 7.0 中 fatal error : Uncaught Error: Call to undefined function json_encode()

我的服务器配置:[root@server~]#php-vPHP7.0.22(cli)(built:Aug7201716:18:27)(NTS)[root@server~]#nginx-vnginxversion:nginx/1.10.2操作系统:CentOS7.3.1611(核心)我的YUM安装详情:[root@server~]#yumlistinstalled|grepphpphp70u-cli.x86_647.0.22-2.ius.centos7@iusphp70u-common.x86_647.0.22-2.ius.centos7@iusphp70u-fpm.x86_647.0.

php - 在 PHP 中,为什么 json_encode 比序列化慢?

我不明白,json_encode生成的数据比serialize简单得多,但JSON编码和解码函数都比serialize和unserialize对应。为什么? 最佳答案 与serialize的memcpy相比,json_encode进行字符串解析和大量分配在source中玩得开心如果你真的有心情。 关于php-在PHP中,为什么json_encode比序列化慢?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.