国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home php教程 php手冊 The PHP framework I developed using 13 lines of code

The PHP framework I developed using 13 lines of code

Jul 09, 2016 am 09:10 AM
php framework code Open source programming programming language software development

The PHP framework I developed with only 13 lines of code. If you don’t understand the framework and don’t know what the framework does for you, you can download this framework and take a look,

In addition, if you want to develop your own framework, you can also extend the ideas of this framework.

Source code download address: http://download.csdn.net/detail/sibang/6197315

Code:

<span style="color: #008080;"> 1</span> <span style="color: #000000;">PHP
</span><span style="color: #008080;"> 2</span> <span style="color: #008000;">/*</span><span style="color: #008000;">*
</span><span style="color: #008080;"> 3</span> <span style="color: #008000;">    PHP極簡框架
</span><span style="color: #008080;"> 4</span> <span style="color: #008000;">    交流:
</span><span style="color: #008080;"> 5</span> <span style="color: #008000;">        QQ群: 223494678
</span><span style="color: #008080;"> 6</span> <span style="color: #008000;">        http://7di.net
</span><span style="color: #008080;"> 7</span> <span style="color: #008000;">    用法
</span><span style="color: #008080;"> 8</span> <span style="color: #008000;">        http://URL
</span><span style="color: #008080;"> 9</span> <span style="color: #008000;">        http://URL/hello
</span><span style="color: #008080;">10</span> <span style="color: #008000;">        http://URL/seven.php?w=hello
</span><span style="color: #008080;">11</span> <span style="color: #008000;">/*</span><span style="color: #008000;">*/</span>
<span style="color: #008080;">12</span> 
<span style="color: #008080;">13</span> <span style="color: #008080;">Header</span>('Content-type: text/html; charset=UTF-8'<span style="color: #000000;">);
</span><span style="color: #008080;">14</span> <span style="color: #800080;">$w</span>=<span style="color: #0000ff;">isSet</span>(<span style="color: #800080;">$_REQUEST</span>['w']) ? <span style="color: #008080;">AddsLashes</span>(<span style="color: #800080;">$_REQUEST</span>['w']) : ''<span style="color: #000000;">;
</span><span style="color: #008080;">15</span> <span style="color: #800080;">$w</span>=(<span style="color: #008080;">Trim</span>(<span style="color: #800080;">$w</span>)=='') ? 'index' : <span style="color: #800080;">$w</span><span style="color: #000000;">;
</span><span style="color: #008080;">16</span> 
<span style="color: #008080;">17</span> <span style="color: #0000ff;">IF</span>(!<span style="color: #008080;">is_callable</span>(<span style="color: #800080;">$w</span><span style="color: #000000;">)) {
</span><span style="color: #008080;">18</span>     <span style="color: #0000ff;">Exit</span>('Error:'.<span style="color: #ff00ff;">__LINE__</span>.',參數(shù)錯誤!'<span style="color: #000000;">);
</span><span style="color: #008080;">19</span> <span style="color: #000000;">}
</span><span style="color: #008080;">20</span> <span style="color: #800080;">$w</span><span style="color: #000000;">();
</span><span style="color: #008080;">21</span> 
<span style="color: #008080;">22</span> <span style="color: #0000ff;">Function</span><span style="color: #000000;"> hello(){
</span><span style="color: #008080;">23</span>     <span style="color: #0000ff;">Echo</span> 'Hello World!'<span style="color: #000000;">;
</span><span style="color: #008080;">24</span> <span style="color: #000000;">}
</span><span style="color: #008080;">25</span> 
<span style="color: #008080;">26</span> <span style="color: #0000ff;">Function</span><span style="color: #000000;"> index(){
</span><span style="color: #008080;">27</span>     <span style="color: #0000ff;">Echo</span> '此框架由Seven編寫,來自QQ群:223494678'<span style="color: #000000;">;
</span><span style="color: #008080;">28</span> }

Contents of .htaccess

Below is the comment:

Header('Content-type: text/html; charset=UTF-8');
//定義編碼

$w=isSet($_REQUEST['w']) ? AddsLashes($_REQUEST['w']) : '';
//獲取參數(shù)w的值,w來自于rewrite規(guī)則文件.htaccess

$w=(Trim($w)=='') ? 'index' : $w;
//如果參數(shù)w的值為空,則訪問默認的index方法

IF(!is_callable($w)) {
	//如果$w所屬的function不存在

	Exit('Error:'.__LINE__.',參數(shù)錯誤!');
	//拋出錯誤
}
$w();
//調(diào)用$w名稱對應的function,例如:http://URL/hello會調(diào)用hello()這個function

//自定義方法(可自由擴展)
Function hello(){
	Echo 'Hello World!';
}

Function index(){
	Echo '此框架由Seven編寫,來自QQ群:223494678';
}

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

The Future of C  : Adaptations and Innovations The Future of C : Adaptations and Innovations Apr 27, 2025 am 12:25 AM

The future of C will focus on parallel computing, security, modularization and AI/machine learning: 1) Parallel computing will be enhanced through features such as coroutines; 2) Security will be improved through stricter type checking and memory management mechanisms; 3) Modulation will simplify code organization and compilation; 4) AI and machine learning will prompt C to adapt to new needs, such as numerical computing and GPU programming support.

MySQL vs. Other Programming Languages: A Comparison MySQL vs. Other Programming Languages: A Comparison Apr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ??such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ??have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

Why Use PHP? Advantages and Benefits Explained Why Use PHP? Advantages and Benefits Explained Apr 16, 2025 am 12:16 AM

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.

Python: Automation, Scripting, and Task Management Python: Automation, Scripting, and Task Management Apr 16, 2025 am 12:14 AM

Python excels in automation, scripting, and task management. 1) Automation: File backup is realized through standard libraries such as os and shutil. 2) Script writing: Use the psutil library to monitor system resources. 3) Task management: Use the schedule library to schedule tasks. Python's ease of use and rich library support makes it the preferred tool in these areas.

Python: Games, GUIs, and More Python: Games, GUIs, and More Apr 13, 2025 am 12:14 AM

Python excels in gaming and GUI development. 1) Game development uses Pygame, providing drawing, audio and other functions, which are suitable for creating 2D games. 2) GUI development can choose Tkinter or PyQt. Tkinter is simple and easy to use, PyQt has rich functions and is suitable for professional development.

HTML: Is It a Programming Language or Something Else? HTML: Is It a Programming Language or Something Else? Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

See all articles