简体   繁体   中英

How can I make sure that every controller sees DboSource?

There were issues that some controllers are using DboSource methods and I added the

App::uses('DboSource', 'Model/DboSource');

line to the class file of some base controllers from which other controllers are inherited. However, I wonder whether there is a way in Cake to make sure that a class is loaded by every controller. My current solution works, I just intend to improve it. Is this possible? Thanks!

您可以将其添加到您的app/Config/bootstrap.php文件中,它将在每个请求时加载。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM