Simple, easy to use, full functionality of the PHP framework.
PHP 8.0 +
Download the latest release package and unzip it.
Note: In Nginx, you need to add the following rules to the rewrite rule file:
if ($request_uri !~ ^/(stc/.*|favicon.\w+?\??.*|apple[\w-]+?\.png\??.*|[\w-]+?\.txt\??.*)$) {
rewrite ^/([\s\S]*)$ /index.php?__path=$1 last;
}
Captcha, Consistent, Crypto, Db (MySQL), Fs, Kv (Redis), Net, Scan, Session, Jwt, Sql, Text.
Following the principle of ready-to-use, it encapsulates commonly used libraries in a uniform style.
When using various libraries directly, the system will load them automatically.
You can use it like this:
$res = Net::open('https://xxx/test')->post()->data(['a' => '1', 'b' => '2'])->request();
You can also use it like this:
$res = Net::get('https://xxx/test');
Custom dns results can be set:
$res = Net::get('https://xxx/test', [
'hosts' => [
'xxx' => '111.111.111.111'
]
]);
You can also choose other local network cards to access:
$res = Net::get('https://xxx/test', [
'local' => '123.123.123.123'
]);
Link reuse can greatly improve access speed when accessing multiple URLs:
$res1 = Net::get('https://xxx/test1', [
'reuse' => true
]);
$res2 = Net::get('https://xxx/test2', [
'reuse' => true
]);
Net::closeAll();
It also has a complete cookie manager that can easily retrieve and store cookies anywhere. When sending requests, the system will select the domain and path to send based on the cookie settings. If there is an illegal cross-domain setting in Set-Cookie, it will be discarded and not recorded, just like a real browser:
$res1 = Net::get('https://xxx1.xxx/test1', [], $cookie);
$res2 = Net::get('https://xxx2.xxx/test2', [], $cookie);
Note: The Net library supports both options and open chain operations. For example, Net::open('xxx')->follow()->timeout(60)->reuse()->save(ROOT_PATH . 'doc/test.txt')->request();
With a large number of useful interfaces, you can easily filter the data you need from the database:
$ls = Order::where([
'state' => '1'
])->by('id', 'DESC')->page(10, 1);
$list = $ls->all();
$count = $ls->count();
$total = $ls->total();
Get a user:
$user = User::select(['id', 'user'])->filter([
['time_add', '>=', '1583405134']
])->first();
Use the _checkXInput method to perform XSRF detection and prevent malicious access.
With the help of the Scan library, it's easy to implement scan login.
Achieve reverse proxy functionality effortlessly by utilizing the rproxy method from the Net library, combined with route parameters.
$str = Core::random(16, Core::RANDOM_N);
Captcha::get(400, 100)->getBuffer();
$userList = User::where([
['state', '!=', '0'],
'type' => ['1', '2', '3'],
'is_lock' => '0'
])->all();
Note: All database operations have been protected against injection attacks.
$sql->select(['SUM(user.age) age'], 'order')->leftJoin('user', ['order.user_id' => Sql::column('user.id')])
The output will be:
SELECT SUM(`test_user`.`age`) AS `age` FROM `test_order` LEFT JOIN `test_user` ON `test_order`.`user_id` = `test_user`.`id`
It's so easy to write!
$this->_loadLocale($_GET['lang'], 'test');
echo l('copy');
Based on the different values of lang, the output will be: Copy, 复制, 複製, コピー, etc., configured in the /data/locale/ directory.
Directly validate submitted data based on strings, numbers, comparisons, and even regular expressions. It's convenient!
[
'he' => ['require', [0, 'The he param does not exist.']],
'num' => ['> 10', [0, 'The num param must > 10.']],
'reg' => ['/^[A-CX-Z5-7]+$/', [0, 'The reg param is incorrect.']],
'arr' => [['a', 'x', 'hehe'], [0, 'The arr param is incorrect.']]
]
See: /test/ctr-checkinput
You can visit /test/ to see more examples.
This library is published under Apache-2.0 license.