The PHP framework I developed using 13 lines of code
Jul 09, 2016 am 09:10 AMThe 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ù)錯(cuò)誤!'<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的值為空,則訪問默認(rèn)的index方法 IF(!is_callable($w)) { //如果$w所屬的function不存在 Exit('Error:'.__LINE__.',參數(shù)錯(cuò)誤!'); //拋出錯(cuò)誤 } $w(); //調(diào)用$w名稱對應(yīng)的function,例如:http://URL/hello會(huì)調(diào)用hello()這個(gè)function //自定義方法(可自由擴(kuò)展) Function hello(){ Echo 'Hello World!'; } Function index(){ Echo '此框架由Seven編寫,來自QQ群:223494678'; }

Hot AI Tools

Undress AI Tool
Undress images for free

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

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

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics

The main difference between Java and other programming languages ??is its cross-platform feature of "writing at once, running everywhere". 1. The syntax of Java is close to C, but it removes pointer operations that are prone to errors, making it suitable for large enterprise applications. 2. Compared with Python, Java has more advantages in performance and large-scale data processing. The cross-platform advantage of Java stems from the Java virtual machine (JVM), which can run the same bytecode on different platforms, simplifying development and deployment, but be careful to avoid using platform-specific APIs to maintain cross-platformity.

C is widely used in the fields of game development, embedded systems, financial transactions and scientific computing, due to its high performance and flexibility. 1) In game development, C is used for efficient graphics rendering and real-time computing. 2) In embedded systems, C's memory management and hardware control capabilities make it the first choice. 3) In the field of financial transactions, C's high performance meets the needs of real-time computing. 4) In scientific computing, C's efficient algorithm implementation and data processing capabilities are fully reflected.

Javaremainsagoodlanguageduetoitscontinuousevolutionandrobustecosystem.1)Lambdaexpressionsenhancecodereadabilityandenablefunctionalprogramming.2)Streamsallowforefficientdataprocessing,particularlywithlargedatasets.3)ThemodularsystemintroducedinJava9im

The main difference between HTML and programming languages ??is that HTML is a static markup language used to describe web page structure and content display, while programming languages ??are dynamic tools used for logical processing and data operations. 1) HTML defines the web page structure through tags, and logical operations cannot be performed. 2) Programming languages ??such as Python can implement logical operations and data processing. 3) HTML is suitable for building static web pages, and programming languages ??are used for dynamic applications and back-end services.

HTML is not a programming language, but dynamic functions can be implemented through JavaScript and server-side languages ??such as PHP. 1. HTML structure content, 2. JavaScript makes it interactive, 3. Server-side language dynamically generates HTML.

As of October 2023, Laravel's latest version is 10.x. 1.Laravel10.x supports PHP8.1, improving development efficiency. 2.Jetstream improves support for Livewire and Inertia.js, simplifies front-end development. 3.EloquentORM adds full-text search function to improve data processing performance. 4. Pay attention to dependency package compatibility when using it and apply cache optimization performance.

The core features of Java include platform independence, object-oriented design and a rich standard library. 1) Object-oriented design makes the code more flexible and maintainable through polymorphic features. 2) The garbage collection mechanism liberates the memory management burden of developers, but it needs to be optimized to avoid performance problems. 3) The standard library provides powerful tools from collections to networks, but data structures should be selected carefully to keep the code concise.

Javaremainsatopchoicefordevelopersduetoitsplatformindependence,object-orienteddesign,strongtyping,automaticmemorymanagement,andcomprehensivestandardlibrary.ThesefeaturesmakeJavaversatileandpowerful,suitableforawiderangeofapplications,despitesomechall
