3 回答

TA貢獻1784條經(jīng)驗 獲得超8個贊
stdClass
Object
object
json_decode()
SoapClient::__soapCall
<?php//Example with StdClass$json = '{ "foo": "bar", "number": 42 }';$stdInstance = json_decode($json);echo $stdInstance->foo . PHP_EOL; //"bar"echo $stdInstance->number . PHP_EOL; //42//Example with associative array$array = json_decode($json, true); echo $array['foo'] . PHP_EOL; //"bar"echo $array['number'] . PHP_EOL; //42

TA貢獻1835條經(jīng)驗 獲得超7個贊
stdClass
stdClass
class Foo{}$foo = new Foo();echo ($foo instanceof stdClass)?'Y':'N';// outputs 'N'

TA貢獻1789條經(jīng)驗 獲得超10個贊
$page=new stdClass();$page->name='Home';$page->status=1;
<?phpclass PageShow { public $currentpage; public function __construct($pageobj) { $this->currentpage = $pageobj; } public function show() { echo $this->currentpage->name; $state = ($this->currentpage->status == 1) ? 'Active' : 'Inactive'; echo 'This is ' . $state . ' page'; }}
$pageview=new PageShow($page); $pageview->show();
- 3 回答
- 0 關(guān)注
- 547 瀏覽
添加回答
舉報