本文整理汇总了PHP中YiiBase::import方法的典型用法代码示例。如果您正苦于以下问题:PHP YiiBase::import方法的具体用法?PHP YiiBase::import怎么用?PHP YiiBase::import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YiiBase
的用法示例。
在下文中一共展示了YiiBase::import方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: realpath
<?php
YiiBase::setPathOfAlias('ygin', realpath(dirname(__FILE__) . '/../'));
YiiBase::setPathOfAlias('ngin', realpath(dirname(__FILE__) . '/../'));
// TODO придется оставить на какое-то время для совместимости.
//Название хоста, для отправки отчетов об ошибках
$errorSubjectHost = '';
if (isset($_SERVER['HTTP_HOST'])) {
//Если пришло в punicode
if (strpos($_SERVER['HTTP_HOST'], 'xn--') !== false) {
YiiBase::import('ygin.lib.IDNA', true);
$idna = new Net_IDNA_php4();
$errorSubjectHost = $idna->decode($_SERVER['HTTP_HOST']);
} else {
$errorSubjectHost = $_SERVER['HTTP_HOST'];
}
} else {
$errorSubjectHost = realpath(dirname(__FILE__) . '/../../');
}
return array('basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '../../protected', 'aliases' => array('temp' => 'webroot.temp', 'xupload' => 'ygin.ext.xupload', 'fileUpload' => 'ygin.components.fileUpload'), 'preload' => array('log'), 'import' => array('ygin.helpers.*', 'ygin.components.*', 'ygin.interface.*'), 'components' => array('session' => array('autoStart' => false, 'cookieParams' => array('timeout' => '7200')), 'db' => array('nullConversion' => PDO::NULL_EMPTY_STRING), 'log' => array('class' => 'CLogRouter', 'routes' => array('email_error' => array('class' => 'ygin.components.DaEmailLogRoute', 'levels' => 'error, warning', 'filter' => array('class' => 'ygin.components.DaLogFilter', 'ignoreCategories' => array('exception.CHttpException.404', 'exception.DaHttpException.*')), 'subject' => 'Ошибка на сайте (' . $errorSubjectHost . ')', 'enabled' => YII_DEBUG == false), 'mailErrorLog' => array('class' => 'DaFileLogRoute', 'categories' => 'application.sendMail.error', 'logFile' => 'mail_error_log.log'), 'errorLog' => array('class' => 'CFileLogRoute', 'levels' => 'error, warning', 'logFile' => 'error_log.log', 'filter' => array('class' => 'ygin.components.DaLogFilter', 'ignoreCategories' => array('exception.CHttpException.404', 'exception.DaHttpException.*', 'application.sendMail.error'), 'logVars' => array('_GET', '_POST', '_FILES', '_COOKIE', '_SESSION', '_SERVER'))), 'loginLog' => array('class' => 'DaFileLogRoute', 'levels' => 'info', 'categories' => 'application.login.*', 'logFile' => 'login.log', 'filter' => array('class' => 'CLogFilter', 'logVars' => array()))))));
示例2: getItems
<?php
YiiBase::import('application.extensions.treeMenu.TreeMenu');
class BrickMenu extends TreeMenu
{
protected function getItems()
{
$items = array(array('label' => 'Главная', 'url' => array('/site/index')));
foreach (Yii::app()->getModules() as $id => $m) {
$moduleObj = Yii::app()->getModule($id);
if ($moduleObj instanceof CBrick) {
$items = array_merge($items, $moduleObj->getMenuItems());
}
}
return $items;
}
}
示例3: yiiVersion
/**
* Initialize Yii and return Yii version
*
* @param bool $refresh
* @return bool|string Yii version or false if Yii is not found
*/
public static function yiiVersion($refresh = false)
{
static $yiiVersion;
if ($yiiVersion !== null && !$refresh) {
return $yiiVersion;
}
$yii_file = self::yiiPath($refresh) . '/framework/YiiBase.php';
if (!file_exists($yii_file)) {
return $yiiVersion = false;
}
require_once $yii_file;
YiiBase::setPathOfAlias('yii_embed', YII_EMBED_PATH . 'app');
YiiBase::import('yii_embed.components.*');
YiiBase::import('yii_embed.models.*');
YiiBase::$enableIncludePath = false;
return $yiiVersion = YiiBase::getVersion();
}
示例4: __set
<?php
/**
* @file nameQRCodeComponent.php
* @username jiangmin.sun@cgtz.com
* @date 14-10-21
* @time 下午3:48
*/
YiiBase::import('application.extensions.phpqrcode.phpqrcode', true);
class QRCodeComponent extends CApplicationComponent
{
public $data;
public $width;
public $height;
public function __set($key, $value)
{
$this->{$key} = $value;
}
public function __get($name)
{
return $this->{$name};
}
public function png()
{
// 二维码数据
$data = $this->url;
// 生成的文件名
$filename = Yii::app()->params['up_path'] . "/" . time() . ".png";
// 纠错级别:L、M、Q、H
$errorCorrectionLevel = 'L';
// 点的大小:1到10