在我的一个“元素”中,我想使用 Inflector
类,但它总是显示
Fatal error: Inflector class not found.
如何在我的 View 文件中以蛋糕方式包含此类?
我尝试添加 use Cake\Utility
和 use Cake\Utility\Inflector
,但两者都没有他们提供了帮助。
请您参考如下方法:
试试这个
\Cake\Utility\Inflector::humanize('Inflector working in the view')
来自模型、 View 或 Controller 等任何地方的完全限定命名空间
Note: Do no forget to use "\" at the start!