首页 > Thinkphp 自动加载的问题?

Thinkphp 自动加载的问题?

我在 Vendor 中搭建了一个 VendorTester.class.php 文件来测试, Controller 完全没理会...

#file: VendorTester.class.php
<?php 
class VendorTester {
  public function sayHi(){
    echo "hello world";
  }
}

Controller 里面的代码

$vendorTester = new VendorTester();
$vendorTester->sayHi();

Vendor 文件夹下的类应该以 Vendor 为命名空间,否则 ThinkPHP 的自动加载器不会扫描这个目录的。

【热门文章】
【热门文章】