yiiapi/tests/TestApplication.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

class TestApplication extends CWebApplication
{
	public function __construct($config=null)
	{
		Yii::setApplication(null);
		clearstatcache();
		parent::__construct($config);
	}

	public function reset()
	{
		$this->removeDirectory($this->getRuntimePath());
		$this->removeDirectory($this->getAssetPath());
	}

	protected function removeDirectory($path)
	{
		if(is_dir($path) && ($folder=@opendir($path))!==false)
		{
			while($entry=@readdir($folder))
			{
				if($entry[0]==='.')
					continue;
				$p=$path.DIRECTORY_SEPARATOR.$entry;
				if(is_dir($p))
					$this->removeDirectory($p);
				@unlink($p);
			}
			@closedir($folder);
		}
	}

	public function getAssetPath()
	{
		return dirname(__FILE__).DIRECTORY_SEPARATOR.'assets';
	}

	public function getRuntimePath()
	{
		return dirname(__FILE__).DIRECTORY_SEPARATOR.'runtime';
	}

	public function getBasePath()
	{
		return dirname(__FILE__);
	}

	public function setBasePath($value)
	{
	}

	public function loadGlobalState()
	{
		parent::loadGlobalState();
	}

	public function saveGlobalState()
	{
后面还有 3 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。