PHP code example of dfer / df-php
1. Go to this page and download the library: Download dfer/df-php 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/ */
dfer / df-php example snippets
composer create-project dfer/df-php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?s=$1
:: 基础命令
php df
:: 将项目的基础源码同步至`df-php-root`项目
php df dev:root
:: 将项目的`df-php-core`源码同步至`df-php-core`项目
php df dev:core
<!-- 列表 -->
$output = MusicModel::select();
$output = ArticleModel::order('asc')->select();
$output = NotepadModel::order(['time', 'desc'])->select();
$output = MusicModel::where(3)->select();
$output = MusicModel::where(["id" => 3])->select();
<!-- 读取第一条数据,不满足条件则返回空 -->
$output = ArticleModel::where(3)->find();
<!-- 始终读取第一条数据 -->
$output = NotepadModel::where(["id" => 3])->first();
<!-- 直接生成dataTable的接口数据 -->
NotepadModel::showPage(str("admin/column/{0}_ss",[NotepadModel::getName()]));
<!-- 读取第一条数据的某个值 -->
$layout = ConfigModel::where(['key' => 'layout'])->value('val');
$ret = ConfigModel::insert(['val'=>123]);
$ret = LinkModel::update($dt);
$ret = LinkModel::where(null)->update($dt);
$ret = LinkModel::where([])->update($dt);