0

なぜ私の check_multi 関数が -- を返すのか誰にもわかりますか?

致命的なエラー: 21 行目の /var/www/vhosts/aero.onelinksoftware.com/application/models/Design.php の未定義関数 check_multi() の呼び出し

上記のエラーが表示され、何が間違っているのかわかりません。関数をパブリック、プライベート、静的、およびその他の組み合わせとして設定しようとしましたが、何を試しても; システムはまだエラーになります。Zend のモデル内で関数を呼び出すことはできませんか? 自分で作成した関数が、自分で作成したクラス内にある場合に使用できない理由がわかりません。

check_multi 呼び出しの前にエコーして死亡した場合。テキストなどを見ることができます。構文のphpテストも実行しましたが、報告されている限り有効です。

class Model_Design
{
    /**
     * Constructs our partials.
     *
     * @return void
     */
    public function __construct($key)
    {
        // Get the DB Connection
        $db = Zend_Registry::Get('db');
        // Setup the SQL Statement
        $sql = $db->select()->from('design', array('id'));
            // Get the Result
            $result  = $sql->query();
            // Get our Row
            $row     = $result->fetchAll();

            if(check_multi($key, $row)) {
                echo "omg"; die();
            }

        // Make sure the id isn't empty
        if (empty($key)) {
            throw new Exception('You have a disturbing lack of variables.');
        }

        // Store the id
        $this->variables = $key;


        // Construct our query
        $sql = $db->select()->from('design')->where('`id` = ?', $key);
            // Get the result
            //$result    = $sql->query();
            //$row   = $result->fetch();
    }

    private function check_multi($n, $arr)
    {
        foreach ($arr as $key => $val) {
            if ($n===$key) {
                return $key;
            }
        }
        return false;
    }
}
4

2 に答える 2

1

試す:

$this->check_multi($key, $row);

コンテナー クラス内から変数または関数にアクセスするには、$this を使用する必要があります。$this はクラスの現在のインスタンスです。

于 2012-11-28T15:11:20.673 に答える
1

関数をどのように呼び出しますか? function_exists() を使用するか、 function_exists()$this->check_multi($n,$arr);を試して、関数が実際に存在するかどうかを確認できます

于 2012-11-28T15:13:08.440 に答える