在扩展包里加载一个路由文件,只需要在服务提供者里的 boot 方法里使用 include : 根据服务提供者来包含一个路由文件
public function boot() { include __DIR__."/../../routes.php"; }
注意: 如果您的扩展包里使用了控制器,您必须要确认您在 composer.json 文件里的 auto-load 区块里,是否适当的配置这些控制器。