解析错误:语法错误,蛋糕烘焙模型时出现意外的 T_STRING
我在蛋糕烘焙模型时遇到解析错误:语法错误,意外的 T_STRING 因为生成的模型有单引号未闭合 喜欢 '
Photo' => array(
'className' => 'Photo',
'foreignKey' => 'album_id',
'dependent' => false,
'conditions' => ',
'fields' => ',
'order' => ',
'limit' => ',
'offset' => ',
'exclusive' => ',
'finderQuery' => ',
'counterQuery' => '
我该如何解决这个问题?
I'm getting Parse error: syntax error, unexpected T_STRING while i cake bake model
because the model generated has single quotes not closed
like
'
Photo' => array(
'className' => 'Photo',
'foreignKey' => 'album_id',
'dependent' => false,
'conditions' => ',
'fields' => ',
'order' => ',
'limit' => ',
'offset' => ',
'exclusive' => ',
'finderQuery' => ',
'counterQuery' => '
how do i fix this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在我看来,你的问题是在照片模型的生成附近开始的。您是否有可能不小心将型号名称输入为“Photo”,而不是“Photo”?
要解决此问题,只需正确配对单引号即可。删除照片后的标记,然后更改其他标记,以便它们以语法正确的语义配对。
烘焙方法确实没有什么特别的。它们可以帮助在项目开始时自动生成一些内容,但之后,您可以根据需要随意修改它们。
It looks to me like your problem starts up near the generation of the Photo model. Is it possible that you accidentally typed in the model name as Photo', rather than Photo?
To fix, simply correctly pair up the single quote marks. Delete the mark after photo, then change the others so they pair up in syntactically correct semantics.
There really is nothing too special about the baked methods. They can help auto generate some stuff at the start of a project, but after that, feel free to modify them as necessary.
http://bakery.cakephp.org/articles/ view/custom-baking-with-cakephp-1-3
作为 Travis 答案的扩展,您还可以创建自己的烘焙模板,这使得很容易节省大量修改默认模板的时间,这,IMO都是垃圾。
http://bakery.cakephp.org/articles/view/custom-baking-with-cakephp-1-3
As an extension to Travis's answer, you can also create your own bake templates, this makes it very easy to save on a lot of modifying the default templates, which, IMO are crap.