草庐IT

something_Decode

全部标签

php - json_decode 返回 NULL,json_last_error_msg 给出 "Control character error, possibly incorrectly encoded"

当读入我的编辑器时,该文件看起来很好。$file=file_get_contents('path/to/file.json');$json=json_decode($file,true);var_dump($json);//nullechojson_last_error_msg();//Controlcharactererror,possiblyincorrectlyencoded关于此错误消息的含义并不多。 最佳答案 您可以删除controlcharacter,PCRE支持字符类的POSIX表示法[:cntrl:]$json=pr

php - 如何解码 eval( gzinflate( base64_decode(

我在我的网站中注入(inject)了这段代码。如何解码尾随字符串?我需要知道发生了什么以及它背后的代码是什么。 最佳答案 这应该输出将由eval()执行的代码:我希望这就是您要找的。 关于php-如何解码eval(gzinflate(base64_decode(,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/3701291/

php - json_encode/json_decode 与 Zend_Json::encode/Zend_Json::decode

您知道性能和内存消耗的最佳方法是什么吗?提前致谢。再见。 最佳答案 功能上的唯一区别如下(根据ZendFramework文档):WhenamethodtoJson()isimplementedonanobjecttoencode,Zend_JsoncallsthismethodandexpectstheobjecttoreturnaJSONrepresentationofitsinternalstate.除此之外没有任何区别,如果安装了json扩展,它会自动选择使用PHP的json_encode功能。再次来自他们的文档:Ifext/

php - FPDF 中的 html_entity_decode(使用 tFPDF 扩展)

我正在使用tFPDF生成PDF。php文件是UTF-8编码的。例如,我希望©作为版权符号输出到pdf中。我试过iconv、html_entity_decode、htmlspecialchars_decode。当我尝试解码字符串并将其硬编码到另一个文件中并解码时,它按预期工作。所以出于某种原因,它没有以PDF格式输出。我试过输出缓冲。我正在使用DejaVuSansCondensed.ttf(真实字体)。tFPDF链接:http://fpdf.org/en/script/script92.php我没有想法。我尝试了双重解码,我到处检查以确保它没有在其他任何地方被编码。

php - 未捕获的异常 'Google_Auth_Exception',消息为 'Could not json decode the token'

我正在使用google-api-client-php库中的user-example.php,它抛出了错误Fatalerror:Uncaughtexception'Google_Auth_Exception'withmessage'Couldnotjsondecodethetoken'in/Applications/XAMPP/xamppfiles/htdocs/Calendar/google-api-php-client/src/Google/Auth/OAuth2.php:174Stacktrace:#0/Applications/XAMPP/xamppfiles/htdocs/Ca

php - 'safe' json_decode( ,,, ) 以防止耗尽内存

在我的应用程序中,我经常调用一个返回json字符串的外部api。$url='api.example.com/xyz';$blah=json_decode(file_get_contents($url));但在某些情况下我得到PHPFatalerror:Allowedmemorysizeofxxxbytesexhausted(triedtoallocate32bytes)in...我无法控制外部API,当然我可以增加php的内存,但这有一些缺点。1-无论我设置什么尺寸,都可能仍然太小。2-如果我将内存大小设置为“无限”,那么我可能会冒着杀死我的服务器的风险。理想情况下,我想在调用json

php - json_decode 为字符串变量返回 NULL

我在json_decode上遇到了一个非常奇怪的问题,代码如下:$url="http://localhost:8983/solr/db/select?wt=json&rows=1&q=94305";$string=file_get_contents($url);echo$string;echo'';$json=json_decode($string);var_dump($json);我得到了以下结果:{"responseHeader":{"status":0,"QTime":0,"params":{"q":"94305","wt":"json","rows":"1"}},"respon

php - json_decode 是舍入 float ,我该如何防止呢?

我有一个相当大的json文件,其坐标格式如下"[[3.2,1],[4.8,2]]"代表(3.2,1)和(4.8,2)我正在使用这些坐标来生成D3地理map,但是当php将此信息建模为geoJSON对象时,我遇到了以下错误:我需要将坐标转换成一个数组,为此我使用了json_decode。然而:json_decode("[[3.2,1],[4.8,2]]")返回Array([0]=>Array([0]=>3[1]=>1)[1]=>Array([0]=>4[1]=>2))我丢失小数点的地方。我怎样才能避免这种情况?编辑:{"type":"FeatureCollection","feature

php - 发出警告 : json_decode() expects at most 2 parameters, 4

我试过像这样使用json_decode:json_decode($string,true,100,JSON_BIGINT_AS_STRING);但是我得到了错误:Warning:json_decode()expectsatmost2parameters,4givenin/home/content/27/2326027/html/sys/get.phponline38如有回应将不胜感激 最佳答案 您的PHP版本似乎不支持这些参数。参见手册:VersionDescription5.4.0Theoptionsparameterwasadd

android - "Something wrong here, didn' t expect PACKAGE to be resumed"android Logcat 中的错误

我有一个仿照Google的LunarLander示例的Android应用程序。我正在使用Android2.0的真实设备(MotorolaDroid)对其进行调试。当方向改变时,程序会因NullPointerException而崩溃。崩溃前的Logcat:02-0100:24:27.956:DEBUG/nate(8358):StartingGame02-0100:24:36.878:DEBUG/dalvikvm(1086):GCfreed1788objects/92256bytesin1389ms02-0100:24:38.542:INFO/WindowManager(1021):Set