所屬章節(jié)課程:用list()結構和each()配合完成數組的遍歷操作:必須掌握
$arr=['name'=>'peter','age'=>3,'ismarride'=>true]; foreach($arr as $key)
2017-08-030個贊
所屬章節(jié)課程:對象的序列化:傳輸或保存一個對象的方法
<?php class Staff { public $name; public $age; public $salary; public function __construct($name,$age,$salary=0) { $this->name=$name; $this->age=$age; $this->salary=$salary; } } $obj1 = new Staff('peter',20,4000); echo '我的姓名:'.$obj1->name,'我的年齡:'.$obj1->age,'我的工資是:'.$obj1->salary; echo '<hr>'; $objstr = serialize($obj1); echo '序列化的對象:'.$objstr;
2017-08-041個贊