PHP Classes

File: hawkphp/hawkphp/loadclass.php

Recommend this page to a friend!
  Classes of tianfan   HawkPHP framework   hawkphp/hawkphp/loadclass.php   Download  
File: hawkphp/hawkphp/loadclass.php
Role: Auxiliary script
Content type: text/plain
Description: framework core
Class: HawkPHP framework
Framework that implements MVC design pattern
Author: By
Last change: fixed some bug
Date: 15 years ago
Size: 702 bytes
 

Contents

Class file image Download
<?php
/*
 * author :&#22825;&#20961;
 * mail:[email protected]
 * homepage:blog.tianfan.net
 */
function __autoload($className){
       
$dir=dirname(__FILE__);
    if(
preg_match('/^[a-z]+Model$/',$className)){
       
$classTag=$dir.'/../model/';
    }
    elseif(
preg_match('/^[a-z]+View$/',$className)){
       
$classTag=$dir.'/../view/';
    }
    else{
        if(
file_exists($dir.'/'.$className.".php"))
           
$classTag=$dir.'/';
        else
           
$classTag=$dir.'/../lib/';
    }
   
/*debug::echo $file;*/
   
$file=$classTag.$className.".php";
    if(!
file_exists($file)){
        return
false;
    }
    else{
        require_once (
$file);
    }
        unset (
$file);
        unset (
$classTag);
        unset (
$dir);
    return
true;
}
?>