PDA

View Full Version : سوال: spl_autoload_register در این کد



myclick
شنبه 08 تیر 1392, 17:52 عصر
سلام از عنوان سوال معلوم هست که مشکل چی هست. لطفا خطوط رو توضیج بدید.


<?php
function autoload($class)
{
$paths=explode(PATH_SEPARATOR,get_include_path() );

$flags=PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTUR E;
$file=strtolower(str_replace("\\",DIRECTORY_SEPARATOR ,trim($class,"\\"))).".php";
foreach($paths as $path)
{
$combined=$path.DIRECTORY_SEPARATOR.$file;
if(file_exists($combined))
{
include($combined);
return;
}

}
}


spl_autoload_register('autoload');
spl_autoload_register(array('autoloader','autoload '));
?>


محتویات فایل autoloader.php


<?php

class Autoloader
{
public static function autoload($class)
{
autoload($class);
echo $class;
}
}

?>