怎么使用basename的时候并没有提取到文件名,还带着命名空间
<?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();
在MAC OS系统下,basename提取不了文件名,在windows下可以正常提取
用的PHPstrom php7.4.3 MacOS系统