我的蛋糕应用程序中有一个 Profile 模型/ Controller ,在/views/profiles 中有一个 index.ctp View 。现在,当我向已填充数据的表中添加一列,然后将相应的代码添加到 View 中以获取该列的数据时,它只会给我一个空结果。
我的模型:
<?php
class Profile extends AppModel
{
var $name = 'Profile';
}
?>
我的 Controller :
<?php
class ProfilesController extends AppController
{
var $name = 'Profiles';
function index()
{
$this->set('profiles', $this->Profile->find('all'));
}
}
?>
我的观点打印(精简):
<?php foreach ($profiles as $profile): ?>
<?php echo $profile['Profile']['id']; ?>
<?php echo $profile['Profile']['username']; ?>
<?php echo $profile['Profile']['created']; ?>
<?php echo $profile['Profile']['thumbnail'];?>
<?php echo $profile['Profile']['account'];?>
<?php endforeach; ?>
基本上,columns id, username, column, thumbnail
总是打印正常,但是当我添加一个名为 account
的列时,它没有返回任何信息(没有打印,但没有错误)。有什么建议吗?
最佳答案
我会删除 app/tmp/cache
中的文件(但保留目录)。
关于php - CakePHP 向表中添加列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3011580/