1. Go to this page and download the library: Download guanguans/think-soar 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/ */
guanguans / think-soar example snippets
php
namespace app\index\controller;
use think\Db;
class Index
{
public function tests()
{
$user = Db::table('fa_user')->where('id', 1)->select();
$sql = Db::table('fa_user')->fetchSql()->select();
// 最后一条sql语句评分
echo soar_score();
// 指定sql语句评分
echo soar_score($sql);
echo soar()->score($sql);
}
}
php
namespace app\index\controller;
use think\Db;
class Index
{
public function tests()
{
$user = Db::table('fa_user')->where('id', 1)->select();
$sql = Db::table('fa_user')->fetchSql()->select();
// 最后一条sql语句explain信息解读
echo soar_html_explain();
echo soar_md_explain();
// 指定sql语句评分explain信息解读
echo soar_html_explain($sql);
echo soar_md_explain($sql);
echo soar()->htmlExplain($sql);
echo soar()->mdExplain($sql);
}
}