<?php
namespace Core;
class Model{
private $table;
public function __construct($table=''){
if ($table!='')
$this->table=$table;
else{
$this->table=substr(basename(get_class($this)),0,-5);
// $this->table=Products;
}
echo $this->table,'<br>';
}
}
namespace Model;
class ProductsModel extends \Core\Model{
}
new \Core\Model('news');
new \Model\ProductsModel();
用的PHPstrom编译