|
1 سال پیش | |
---|---|---|
MaooXB | 2 سال پیش | |
MaooXP | 2 سال پیش | |
jar | 1 سال پیش | |
js | 1 سال پیش | |
lib | 1 سال پیش | |
0618.jar | 2 سال پیش | |
293.txt | 2 سال پیش | |
2xc.jar | 1 سال پیش | |
AK47.json | 1 سال پیش | |
Alist-xyq.json | 2 سال پیش | |
Alist.json | 2 سال پیش | |
Bili-xyq.json | 2 سال پیش | |
Box.jar | 2 سال پیش | |
CLQXB.jar | 2 سال پیش | |
JSfty.json | 1 سال پیش | |
JSmini.json | 1 سال پیش | |
README.md | 2 سال پیش | |
Total_js.json | 1 سال پیش | |
XBPQ.jar | 2 سال پیش | |
XBiubiu.jar | 2 سال پیش | |
XYQBiu.jar | 2 سال پیش | |
aWatch.json | 1 سال پیش | |
alist(Box).json | 2 سال پیش | |
alist.jar | 2 سال پیش | |
atm.jar | 2 سال پیش | |
bili.jar | 2 سال پیش | |
cainisi.json | 1 سال پیش | |
cj.png | 2 سال پیش | |
custom_spider.jar | 2 سال پیش | |
daozhang.json | 1 سال پیش | |
dd.png | 2 سال پیش | |
fm.jar | 1 سال پیش | |
fty.json | 1 سال پیش | |
fy.jar | 1 سال پیش | |
gg.jar | 2 سال پیش | |
lemAC.json | 1 سال پیش | |
ls.png | 2 سال پیش | |
miniJS.json | 1 سال پیش | |
myBiuTV-main.txt | 2 سال پیش | |
myBiuTV-new.txt | 2 سال پیش | |
myLiveBB.txt | 2 سال پیش | |
myMTV.txt | 2 سال پیش | |
qiaoji.jar | 2 سال پیش | |
qiaoji.json | 1 سال پیش | |
qj.jar | 2 سال پیش | |
sc.png | 2 سال پیش | |
token.json | 2 سال پیش | |
top92.jar | 2 سال پیش | |
ts.jar | 1 سال پیش | |
ts.png | 2 سال پیش | |
xiaomi.json | 1 سال پیش | |
ysj.txt | 2 سال پیش | |
zb.png | 2 سال پیش | |
zd.png | 2 سال پیش | |
zy.png | 2 سال پیش |
A simple lightweight framework for building apps and APIs in PHP
First, copy micronPHP to your project root and rename config.example.php
to config.php
.
Each web page of your app should have a controller and/or a view. That's it!
Write your controllers inside app/controllers folder, and write the view inside app/views folder. Match the file names within each folder to associate them together. Set global variables in a controller to use them in the view.
When you visit http://yourmicronsiteurl/pagename, the controller named pagename.php and view named pagename.php will be executed.
You can also create virtual routes that can point to a controller/view with route parameters specified. Routes are defined in app/routes.php file, and route parameters are accessed via the global $routeParams
variable (as an associative array).
Optionally, you can set up your config.php
with details for database access, which can be accessed via the global $db
variable, and that enables using a magicInsert()
function, which can be used to quickly insert arbitrary values from forms or other sources to database tables (just be sure you process the values before putting them in).
The loader automatically sanitizes GET and POST variables in two different ways that can be helpful:
$getVariables
and $postVariables
provide the user input with any HTML tags stripped (using PHP's strip_tags()
method)$_GETRequest
and $_POSTRequest
provide the user input with all sensitive characters converted to their HTML entity values (using PHP's htmlentities()
method)You can do whatever you want with that information.
route('pagename', ["parameter" => "value"])
Example
<a href="<?php echo route('admin/products',array('a' => 'add'))?>" class="btn btn-primary">Add Product</a>
redirectRoute('pagename', ["parameter" => "value"])
Example
redirectRoute('admin/divisions',array('successMessage' => 'Division Added'));
echo assets('path to css file inside public/assets folder')
Example
<link rel="stylesheet" href="<?php echo assets('pretty/css/prettyPhoto.css')?>" type="text/css" media="screen" charset="utf-8" />
echo images('path to css file inside public/images folder')
Example
<img src="<?php echo images('cool/dog.jpg')?>" alt="dog in sunglasses" />
loadView('viewName',[array of data to be passed])
Example
loadView('header',["title" => 'Sample Title'])
validateRequired($userInput, $requiredFields)
Example
$requiredFields = ['title','subject'];
validateRequired($_POST,$requriedFields)
magicInsert('tableName',$_POST) Unset any unwanted parameters using unset() function before using magicInsert()
Example
magicInsert('users',$_POST);