0

我不是什么问题,我在Croogo做了一个简单的博客,问题是不是添加修改删除,因为阿拉伯语??

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>

消息错误:在此服务器上找不到请求的地址。

4

1 回答 1

0

我不认为这是因为阿拉伯语,因为当你这样做时:

        echo $this->Form->label('prop_Pledge', 'إقتراح التعهد :  ');

第二个参数是文本。我不知道您使用的是哪个 Cake 版本,但我认为第一个字段应该是 Part.prop_Pledge (Cake v3)。

我建议您尝试使用 debug() 并退出以查看真正的问题在哪里,或者尝试删除阿拉伯字符以查看这是否是您出现问题的原因。

  • 只是一个问题,您的 $this->Form->create() 在哪里?

行已成功添加到数据库但未恢复到索引它显示错误消息

请打印消息错误 hello21 好吗?

希望这会帮助你。

于 2015-05-01T09:36:26.453 回答