بدون توضیح

softeam 8f0a8f5400 上传文件至 '' 1 سال پیش
MaooXB 138807e886 Add files via upload 2 سال پیش
MaooXP b5ed5ef71d 上传文件至 'MaooXP' 2 سال پیش
jar 60eb82646a 删除 'jar/xyq.jar' 1 سال پیش
js c74284409f 删除 'js/爱看机器人.js' 1 سال پیش
lib 02ffba44ab 上传文件至 'lib' 1 سال پیش
0618.jar c4a7303746 上传文件至 '' 2 سال پیش
293.txt b7447d67df 上传文件至 '' 2 سال پیش
2xc.jar 5ce40531c2 上传文件至 '' 1 سال پیش
AK47.json 0f6ae3d31d 上传文件至 '' 1 سال پیش
Alist-xyq.json e07601ee41 上传文件至 '' 2 سال پیش
Alist.json 66a9293c2e 上传文件至 '' 2 سال پیش
Bili-xyq.json e07601ee41 上传文件至 '' 2 سال پیش
Box.jar 763e90b18d 上传文件至 '' 2 سال پیش
CLQXB.jar b0d9212164 上传文件至 '' 2 سال پیش
JSfty.json 015ac9e577 上传文件至 '' 1 سال پیش
JSmini.json c80b182649 上传文件至 '' 1 سال پیش
README.md 57042f1524 Initial commit 2 سال پیش
Total_js.json e4801b23cb 上传文件至 '' 1 سال پیش
XBPQ.jar 68488877d1 上传文件至 '' 2 سال پیش
XBiubiu.jar 1bc9e92884 上传文件至 '' 2 سال پیش
XYQBiu.jar dfb22acd79 上传文件至 '' 2 سال پیش
aWatch.json bc78819595 上传文件至 '' 1 سال پیش
alist(Box).json ec9ae73791 上传文件至 '' 2 سال پیش
alist.jar 6297a15a55 上传文件至 '' 2 سال پیش
atm.jar ca8430dc64 上传文件至 '' 2 سال پیش
bili.jar 3d8fcc356f 上传文件至 '' 2 سال پیش
cainisi.json 9abac9099b 上传文件至 '' 1 سال پیش
cj.png eb5344b70e 上传文件至 '' 2 سال پیش
custom_spider.jar a332f1ef84 上传文件至 '' 2 سال پیش
daozhang.json a77af3f50f 上传文件至 '' 1 سال پیش
dd.png 4f6da9c23f 上传文件至 '' 2 سال پیش
fm.jar cf8fda43e5 上传文件至 '' 1 سال پیش
fty.json ec2d56bbf3 上传文件至 '' 1 سال پیش
fy.jar bb2dea8175 上传文件至 '' 1 سال پیش
gg.jar da2b71e270 上传文件至 '' 2 سال پیش
lemAC.json 8f0a8f5400 上传文件至 '' 1 سال پیش
ls.png eb5344b70e 上传文件至 '' 2 سال پیش
miniJS.json 8f0a8f5400 上传文件至 '' 1 سال پیش
myBiuTV-main.txt 4ca283ba3e 上传文件至 '' 2 سال پیش
myBiuTV-new.txt 73578742e9 上传文件至 '' 2 سال پیش
myLiveBB.txt 4ca283ba3e 上传文件至 '' 2 سال پیش
myMTV.txt 1f7e86c405 上传文件至 '' 2 سال پیش
qiaoji.jar 468aa6030f 上传文件至 '' 2 سال پیش
qiaoji.json 576032c842 上传文件至 '' 1 سال پیش
qj.jar 545a7f50d8 上传文件至 '' 2 سال پیش
sc.png eb5344b70e 上传文件至 '' 2 سال پیش
token.json 9479b324e7 上传文件至 '' 2 سال پیش
top92.jar dfb22acd79 上传文件至 '' 2 سال پیش
ts.jar 7d62916211 上传文件至 '' 1 سال پیش
ts.png eb5344b70e 上传文件至 '' 2 سال پیش
xiaomi.json b79f3458b5 上传文件至 '' 1 سال پیش
ysj.txt 89531fba55 Add files via upload 2 سال پیش
zb.png eb5344b70e 上传文件至 '' 2 سال پیش
zd.png cf3659ff41 上传文件至 '' 2 سال پیش
zy.png dd95cacd7d 上传文件至 '' 2 سال پیش

README.md

micronPHP

A simple lightweight framework for building apps and APIs in PHP

Folder Structure

  • app
    • controllers
    • includes
      • db.php
      • functions.php
      • user_functions.php
    • views
    • routes.php
  • public
    • assets
    • images
  • index.php
  • loader.php
  • config.example.php

Instructions

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).

Database Setup

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).

User Input

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.

Helper Functions

Link Builder

route('pagename', ["parameter" => "value"])

Example <a href="<?php echo route('admin/products',array('a' => 'add'))?>" class="btn btn-primary">Add Product</a>

Redirect

redirectRoute('pagename', ["parameter" => "value"])

Example redirectRoute('admin/divisions',array('successMessage' => 'Division Added'));

Generating Asset Links

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" />

Generating Image Links

echo images('path to css file inside public/images folder')

Example <img src="<?php echo images('cool/dog.jpg')?>" alt="dog in sunglasses" />

Including a view inside another view

loadView('viewName',[array of data to be passed])

Example loadView('header',["title" => 'Sample Title'])

Form Required Fields Validation

validateRequired($userInput, $requiredFields)

Example

$requiredFields = ['title','subject']; 
validateRequired($_POST,$requriedFields)

Save Form to Database

magicInsert('tableName',$_POST) Unset any unwanted parameters using unset() function before using magicInsert()

Example

magicInsert('users',$_POST);