1

我收到一条警告“消息:从空值创建默认对象”,代码如下:

<?php
    if (empty($cd)) {
        $cd->kode_cd ='';
        $cd->judul = '';
        $cd->kategori = '';     
        $cd->stok = ''; 
        $cd->harga = '';
        $type = 'create';   
    } else {
        $type = 'update';
    }
?>
<div id="container">
    <h1>CRUD Data CD</h1>
    <div id="message"><?php echo $this->session->flashdata('message'); ?></div>
    <div id="form">
        <?php
            echo form_open('crud/'.$type);
            echo form_hidden('code',$cd->kode_cd);
        ?>

请帮我解决这个问题。谢谢

4

0 回答 0