久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

“調用未定義的函數"調用類方法時出錯

quot;call to undefined functionquot; error when calling class method(“調用未定義的函數調用類方法時出錯)
本文介紹了“調用未定義的函數"調用類方法時出錯的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

這是錯誤致命錯誤:調用未定義的函數assign(
這是代碼,正如你所看到的,我顯然已經定義了函數,為什么它不起作用

this is the error Fatal error: Call to undefined function assign(
this is the code, as you can see i obviously have defined the function so why is it not working

class shades {
    function create($name, $shades, $slug, $shortDesc, $longDesc, $position){
        $name = sanitize_paranoid_string($name);
        $slug = slug($name);
        $shortDesc = sanitize_sql_string($shortDesc);
        $longDesc = sanitize_sql_string($longDesc);
        $query = mysql_query("INSERT INTO products (type, name, slug, shortDesc, htmlDesc, position)VALUES('shades','$name','$slug','$shortDesc','$longDesc','$position')")or die(mysql_error());  
        $ID = mysql_insert_id();
        assign($shades, $ID);
        if($query) {return true;}
        else {return false;};
    }
    function delassign($toID){
        mysql_query("DELETE FROM assign WHERE type='shades' AND toID='$toID'")or die(mysql_error());    
    }
    function assign($shades, $toID)
    {
        foreach($shades as $shade)
        {
            $result = mysql_query("INSERT INTO assign(type, typeID, toID)VALUES('shades','$shade','$toID')")or die(mysql_error());
            if($result){echo "Added!";}
            else{echo"Not Added!";}
        };  
    }
}

推薦答案

您沒有名為 assign() 的函數,但有一個具有此名稱的方法.PHP 不是 Java,在 PHP 中你必須明確,如果你想調用一個函數

You dont have a function named assign(), but a method with this name. PHP is not Java and in PHP you have to make clear, if you want to call a function

assign()

或方法

$object->assign()

在您的情況下,對函數的調用駐留在另一個方法中.$this 總是指對象本身,其中存在一個方法.

In your case the call to the function resides inside another method. $this always refers to the object, in which a method exists, itself.

$this->assign()

這篇關于“調用未定義的函數"調用類方法時出錯的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Add programmatically a downloadable file to Woocommerce products(以編程方式將可下載文件添加到 Woocommerce 產品)
Get today#39;s total orders count for each product in Woocommerce(獲取今天 Woocommerce 中每種產品的總訂單數)
Add Custom registration fields in WooCommerce and phone field validation issue(在 WooCommerce 和電話字段驗證問題中添加自定義注冊字段)
Add a select field that will change price in Woocommerce simple products(在 Woocommerce 簡單產品中添加一個將更改價格的選擇字段)
Add custom columns to admin products list in WooCommerce 3(在 WooCommerce 3 中將自定義列添加到管理產品列表)
Customizing checkout quot;Place Orderquot; button output html(自定義結帳“下訂單按鈕輸出html)
主站蜘蛛池模板: 久久久亚洲一区 | 日韩国产精品一区二区三区 | 中文字幕一区二区三区精彩视频 | 精品国产乱码久久久久久88av | av在线一区二区三区 | 欧美在线资源 | 精品一区二区久久久久久久网站 | 狠狠干网站 | 污污的网站在线观看 | 日韩成人高清 | 亚洲综合三区 | 男人天堂免费在线 | 久久不卡视频 | 亚洲有码转帖 | 九九在线视频 | 欧美一区免费 | 亚洲一区二区免费视频 | 亚洲综合国产 | 91免费视频观看 | 在线观看国产h | 国产精品久久久久久久久久久免费看 | 日日夜夜天天 | 91麻豆精品一区二区三区 | 亚洲精品永久免费 | 九一国产精品 | 国产精品一区在线播放 | 久久噜噜噜精品国产亚洲综合 | 精品九九九 | 国产精品不卡 | av在线播放网址 | 日韩网站免费观看 | 国产九九九九 | 国产精品女人久久久 | 国产欧美精品在线观看 | 国产精品国产亚洲精品看不卡15 | 色999日韩 | 亚洲精品乱码久久久久久久久久 | 日韩一级免费电影 | 伊人最新网址 | 欧美日韩国产精品激情在线播放 | 亚洲一区视频 |