PHP code example of wangkaibo / quickphp

1. Go to this page and download the library: Download wangkaibo/quickphp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wangkaibo / quickphp example snippets


return [
    'default' => [
        'driver'    => 'mysql',
        'host'      => HOST,
        'database'  => DATABASE,
        'username'  => USER,
        'password'  => '',
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
    ],
    // 如需连接多个数据库
	'conection2' => [
		'driver'    => 'mysql',
		'host'      => HOST,
		'database'  => DATABASE,
		'username'  => USER,
		'password'  => '',
		'charset'   => 'utf8',
		'collation' => 'utf8_unicode_ci',
		'prefix'    => '',
    ],
];

// GET 请求
Router::get('/get', function () {
	echo 'get';
});

// POST 请求
Router::post('/post', function () {
	$post_data = file_get_contents('php://input);
	var_dump($post_data);
});

Router::get(":all", function () {
	view('welcome', compact('name'));
});
shell
php -S 127.0.0.1:8080 public/index.php