我想知道是否可以使用 CakePHP 的函数来重写字符串。
例如,FormHelper 完全符合我的需要:“this_stuff”成为输入标签的“This Stuff”。
我想有一种方法可以解决这个问题,但我找不到任何东西。
提前致谢。
解决方案 变形器::humanize($underscored)
Input: apple_pie, some_thing, people_person
Output: Apple Pie, Some Thing, People Person
我想知道是否可以使用 CakePHP 的函数来重写字符串。
例如,FormHelper 完全符合我的需要:“this_stuff”成为输入标签的“This Stuff”。
我想有一种方法可以解决这个问题,但我找不到任何东西。
提前致谢。
解决方案 变形器::humanize($underscored)
Input: apple_pie, some_thing, people_person
Output: Apple Pie, Some Thing, People Person
您可以使用变形器:
static **Inflector::camelize($underscored)**
Input: Apple_pie, some_thing, people_person
Output: ApplePie, SomeThing, PeoplePerson
http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html