示例#1
0
文件: File.php 项目: kalkin/solarphp
 /**
  * 
  * Uses [[php::include() | ]] to run a script in a limited scope.
  * 
  * @param string $file The file to include.
  * 
  * @return mixed The return value of the included file.
  * 
  */
 public static function load($file)
 {
     Solar_File::$_file = Solar_File::exists($file);
     if (!Solar_File::$_file) {
         // could not open the file for reading
         $code = 'ERR_FILE_NOT_READABLE';
         $text = Solar_Registry::get('locale')->fetch('Solar', $code);
         throw Solar::exception('Solar', $code, $text, array('file' => $file));
     }
     // clean up the local scope, then include the file and
     // return its results.
     unset($file);
     return include Solar_File::$_file;
 }