php 資料庫鏈式操作--虛擬碼
阿新 • • 發佈:2018-12-14
<?php class Test { public function __construct() { echo "construct"; } public function where() { echo "where"; return $this; } public function count() { echo "count"; return $this; } } class Db { static $obj = null; // static public function name($param='') // { // } static function __callStatic($func, $param) { // TODO: Implement __callStatic() method. var_dump($func, $param); self::$obj = new Test(); return self::$obj; } } Db::name('user')->where()->count();