php-5.2

PHP HTTP-Request

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 17:16:40
问题 I have MAMP Pro installed running php 5.2.13. When I try to initialize a HTTP-Request $r = new HttpRequest('http://example.com/', HttpRequest::METH_GET); it tells me: "Class 'HttpRequest' not found in ...". What do I need to do to 'install(?)' it? 回答1: You must enable http extension: http://www.php.net/manual/en/http.setup.php Or you can try new HTTP_Request2: sudo pear install --alldeps HTTP_Request2-alpha And then: $req = new HTTP_Request2('your.url'); $req->setMethod('POST'); $req-

Assigning the return value of new by reference is deprecated

风流意气都作罢 提交于 2019-11-26 16:24:42
I've just got an error. When I try to assign an object like this: $obj_md = new MDB2(); The error I get is "Assigning the return value of new by reference is deprecated". Actually I've been looking for a solution but the only one I've seen is just turn down the politicy of php.ini (error_reporting). I've tried it too, but it didn't work. It's so confusing..I hope you could help me. Thanks in advance. In PHP5 this idiom is deprecated $obj_md =& new MDB2(); You sure you've not missed an ampersand in your sample code? That would generate the warning you state, but it is not required and can be

Parse error: syntax error, unexpected '[', expecting ')' [duplicate]

走远了吗. 提交于 2019-11-26 09:54:57
问题 This question already has answers here : PHP syntax for dereferencing function result (22 answers) Closed 6 years ago . I have this linecode $media = $dc->thumbnail->attributes()[\'url\']; runs fine on my local (WAMP) php 5.4.3 but when i host it on my server cpanel then it gives this error Parse error: syntax error, unexpected \'[\', expecting \')\' the php version on my server is 5.2.17 i dnt see any problem with it, please help 回答1: You need to be running PHP 5.4+ to use shorthand arrays

Assigning the return value of new by reference is deprecated

◇◆丶佛笑我妖孽 提交于 2019-11-26 04:47:56
问题 I\'ve just got an error. When I try to assign an object like this: $obj_md = new MDB2(); The error I get is \"Assigning the return value of new by reference is deprecated\". Actually I\'ve been looking for a solution but the only one I\'ve seen is just turn down the politicy of php.ini (error_reporting). I\'ve tried it too, but it didn\'t work. It\'s so confusing..I hope you could help me. Thanks in advance. 回答1: In PHP5 this idiom is deprecated $obj_md =& new MDB2(); You sure you've not

How to get protected property of object in PHP

﹥>﹥吖頭↗ 提交于 2019-11-26 00:48:20
问题 I have a object having some protected property that I want to get and set. The object looks like Fields_Form_Element_Location Object ( [helper] => formText [_allowEmpty:protected] => 1 [_autoInsertNotEmptyValidator:protected] => 1 [_belongsTo:protected] => [_description:protected] => [_disableLoadDefaultDecorators:protected] => [_errorMessages:protected] => Array ( ) [_errors:protected] => Array ( ) [_isErrorForced:protected] => [_label:protected] => Current City [_value:protected] => 93399