這篇文章將為大家詳細講解有關class_exists函數怎么在php中使用,文章內容質量較高,因此小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關知識有一定的了解。

bool class_exists ( string $class_name [, bool $autoload = true ] )
此功能是否給定的類被定義檢查。this function checks whether or not the given class has been defined.
返回true,如果class_name是一個定義的類,否則返回false。
實例如下:
復制代碼 代碼如下:
function __autoload($class)
{
include($class . '.php');
// check to see whether the include declared the class
if (!class_exists($class, false)) {
trigger_error("unable to load class: $class", e_user_warning);
}
}
if (class_exists('myclass')) {
$myclass = new myclass();
}
關于class_exists函數怎么在php中使用就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
網站欄目:class_exists函數怎么在php中使用-創(chuàng)新互聯
URL地址:http://chinadenli.net/article18/piedp.html
成都網站建設公司_創(chuàng)新互聯,為您提供全網營銷推廣、服務器托管、關鍵詞優(yōu)化、網站策劃、企業(yè)建站、面包屑導航
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯