我不是有什么问题,我在克罗戈做了一个简单的博客,问题是它没有添加、修改或删除,因为阿拉伯语??
function add in controller
`public function admin_add() {
$this->set('title_for_layout', __('Add Part'));
if (!empty($this->request->data)) {
$this->Part->create();
if ($this->Part->save($this->request->data)) {
$this->Session->setFlash(__('The Part has been saved'), 'default', array('class' => 'success'));
$this->redirect(array('action' => 'index'));//, $this->Part->id));
} else {
$this->Session->setFlash(__('The Part could not be saved. Please, try again.'), 'default', array('class' => 'error'));
}
}
}`=>模型
`class Part extends AppModel {
public $name = 'Part';
var $belongsTo = array(
'Market' => array(
'className' => 'Market',
'foreignKey' => 'market_id',
)
);
protected $_displayFields = array(
'id',
'num_part',
'prix_part',
'prop_Pledge',
'prix_Pledge',
);
}`添加视图
<?php $this->extend('/Common/admin_edit'); ?>
<?php echo $this->Form->create('Part');?>
<fieldset>
<div class="tabs">
<ul>
<li><a href="#role-main"><span><?php echo __('Part'); ?></span></a></li>
<?php echo $this->Layout->adminTabs(); ?>
</ul>
<div id="role-main">
<?php
echo $this->Form->label('num_part', 'العدد : ');
echo $this->Form->input('num_part',array('label' => false ));
echo $this->Form->label('prix_part', 'االمبلغ : ');
echo $this->Form->input('prix_part',array('label' => false ));
echo $this->Form->label('prop_Pledge', 'إقتراح التعهد : ');
echo $this->Form->input('prop_Pledge',array('label' => false ));
echo $this->Form->label('prix_Pledge', 'مبلغ التعهد : ');
echo $this->Form->input('prix_Pledge',array('label' => false ));
?>
</div>
<?php echo $this->Layout->adminTabs(); ?>
</div>
</fieldset>
<div class="buttons">
<?php
echo $this->Form->end(__('Save'));
echo $this->Html->link(__('Cancel'), array(
'action' => 'index',
), array(
'class' => 'cancel',
));
?>
</div>消息错误:在此服务器上找不到请求的地址。
发布于 2015-05-01 17:36:26
我不认为这是因为阿拉伯语,因为当你这样做的时候:
echo $this->Form->label('prop_Pledge', 'إقتراح التعهد : ');第二个参数是一个文本。我不知道您使用的是哪个蛋糕版本,但我认为第一个字段应该是Part.prop_Pledge (蛋糕v3)。
我建议您尝试使用debug()和exit来查看真正的问题所在,或者尝试添加删除阿拉伯字符,以查看这是否是问题的原因。
这只是一个问题,您的$->表单->
行已成功添加到数据库,但未返回索引它会显示一条错误消息
你能打印出error hello21这条消息吗?
希望这能对你有所帮助。
https://stackoverflow.com/questions/29388574
复制相似问题