php模块自动加载简单版本autoload.php
第一步:创建autoload.php,内容如下。
class autoload
{
public static function load($classname)
{
$filename=sprintf('%s.php',str_replace('\\','/',$classname));
if(is_file($filename)) require_once $filename;
}
}
spl_autoload_register(['autoload','load']);
第二步:创建测试模块QueryPhone内容如下。
namespace app;
class QueryPhone
{
public static function find($phone)
{
var_dump($phone);
}
}
第三步:创建测试api.php 文件测试,内容如下。
require_once 'autoload.php';
app\QueryPhone::find('1520032823823');
第四步:浏览器测试。
http://blog.popyelove.com/
http://blog.popyelove.com/?p=71
AD:真正免费,域名+虚机+企业邮箱=0元

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Dreamweaver Mac version
Visual web development tools