本文整理汇总了PHP中Config函数的典型用法代码示例。如果您正苦于以下问题:PHP Config函数的具体用法?PHP Config怎么用?PHP Config使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Config函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: make
public function make()
{
$options = Config('session.memcache');
$this->memcache = new Memcache();
$this->memcache->connect($options['host'], $options['port']);
session_set_save_handler(array(&$this, "open"), array(&$this, "close"), array(&$this, "read"), array(&$this, "write"), array(&$this, "destroy"), array(&$this, "gc"));
}
示例2: getClassesName
/**
* 根据班级id获取具体班级名称(一个)
*
* @return string
* @author Hunter.<990835774@qq.com>
*/
public function getClassesName()
{
$classesId = $this->getClassesId();
//根据当前用户的班级值获取对应的班级信息(包括年级)
$classesInfo = Classes::findFirst($classesId);
return Config('CONFIG_GRADE')[$classesInfo->getGradeId()] . $classesInfo->getName();
}
示例3: refresh
public static function refresh()
{
$posts = collect(self::wp_get('get_posts')['posts']);
$posts->each(function ($item) {
//delete all previous posts
if (\Config('cache.default') == 'redis') {
Redis::pipeline(function ($pipe) {
foreach (Redis::keys('laravel:a440:wordpress:posts_*') as $key) {
$pipe->del($key);
}
});
}
Cache::forever('a440:wordpress:posts_' . $item['id'], $item);
});
Cache::forever('a440:wordpress:posts', $posts->transform(function ($item) {
unset($item['content']);
unset($item['url']);
unset($item['status']);
unset($item['title_plain']);
unset($item['modified']);
unset($item['categories']);
unset($item['comments']);
unset($item['attachments']);
unset($item['comment_count']);
unset($item['comment_status']);
unset($item['thumbnail']);
unset($item['custom_fields']);
unset($item['thumbnail_size']);
unset($item['thumbnail_images']['full']);
unset($item['thumbnail_images']['thumbnail']);
unset($item['thumbnail_images']['post-thumbnail']);
return $item;
}));
Cache::forever('a440:wordpress:categories', collect(self::wp_get('get_category_index')['categories']));
}
示例4: messages
/**
* Change Language from user choose.
*
* @return array
*/
public function messages()
{
if (in_array($this->session()->get('lang'), Config('admin.listTransLang'))) {
return ['location_name.required' => trans('banner_messages.locationName') . ' ' . trans('error.required'), 'location_name.alpha_dash' => trans('banner_messages.locationName') . ' ' . trans('error.alpha_dash'), 'limit.required' => trans('banner_messages.limit') . ' ' . trans('error.required'), 'limit.integer' => trans('banner_messages.limit') . ' ' . trans('error.integer'), 'status.required' => trans('banner_messages.status') . ' ' . trans('error.required'), 'status.integer' => trans('banner_messages.status') . ' ' . trans('error.integer'), 'width.required' => trans('banner_messages.sizeWidth') . ' ' . trans('error.required'), 'width.integer' => trans('banner_messages.sizeWidth') . ' ' . trans('error.integer'), 'height.required' => trans('banner_messages.sizeHeight') . ' ' . trans('error.required'), 'height.integer' => trans('banner_messages.sizeHeight') . ' ' . trans('error.integer')];
}
return [];
}
示例5: send
public function send(Msg $msg)
{
// Get template file path.
$templatePath = SPrintF('Notifies/SMS/%s.tpl', $msg->getTemplate());
$smarty = JSmarty::get();
if (!$smarty->templateExists($templatePath)) {
throw new jException('Template file not found: ' . $templatePath);
}
$smarty->assign('Config', Config());
foreach (array_keys($msg->getParams()) as $paramName) {
$smarty->assign($paramName, $msg->getParam($paramName));
}
try {
$message = $smarty->fetch($templatePath);
} catch (Exception $e) {
throw new jException(SPrintF("Can't fetch template: %s", $templatePath), $e->getCode(), $e);
}
$recipient = $msg->getParam('User');
if (!$recipient['Params']['NotificationMethods']['SMS']['Address']) {
throw new jException('Mobile phone number not found for user: ' . $recipient['ID']);
}
$taskParams = array('UserID' => $recipient['ID'], 'TypeID' => 'SMS', 'Params' => array($recipient['Params']['NotificationMethods']['SMS']['Address'], $message, $recipient['ID'], $msg->getParam('ChargeFree') ? TRUE : FALSE));
#Debug(SPrintF('[system/classes/SMS.class.php]: msg = %s,',print_r($msg,true)));
$result = Comp_Load('www/Administrator/API/TaskEdit', $taskParams);
switch (ValueOf($result)) {
case 'error':
throw new jException("Couldn't add task to queue: " . $result);
case 'exception':
throw new jException("Couldn't add task to queue: " . $result->String);
case 'array':
return TRUE;
default:
throw new jException("Unexpected error.");
}
}
示例6: getBreadcrumbTpl
public function getBreadcrumbTpl($appendLinks = true, $separator = ' > ')
{
$links = [];
$total = count($this->_breadcrumb);
$index = 0;
$currentPath = null;
$base_url = Config('main')->ROUTING['BASE_URL'];
foreach ($this->_breadcrumb as $level) {
if (substr($level['link'], 0, 1) === '/') {
$link = $base_url . substr($level['link'], 1);
} else {
$link = $level['link'];
}
if ($appendLinks) {
$currentPath .= $link;
} else {
$currentPath = $link;
}
if (++$index < $total) {
$links[] = '<a href="' . $currentPath . '">' . $level['label'] . '</a>';
} else {
$links[] = '<span>' . $level['label'] . '</span>';
}
}
return join($separator, $links);
}
示例7: __construct
public function __construct($auth_other = null)
{
$this->auth_other = $auth_other;
if ($this->auth_other === null) {
$this->auth_other = Config('AUTH_OTHER');
}
}
示例8: CreateModel
/**
* 创建模型类
* @param name 控制器名称
* @author Colin <15070091894@163.com>
*/
public static function CreateModel($name)
{
$model = $name . Config('DEFAULT_MODEL_SUFFIX');
$modelexplode = explode('\\', $name);
//得到最后一个值
$modelname = array_pop($modelexplode);
return new $model($modelname);
}
示例9: getFilenameOrPath
/**
* 获取文件名以及路径
*/
protected function getFilenameOrPath($FileName)
{
if (empty($FileName)) {
$FileName = METHOD_NAME;
}
$path = $this->view->template_dir . CONTROLLER_NAME . '/' . $FileName . Config('TPL_TYPE');
return $path;
}
示例10: login
public function login(AuthenticateUser $authenticateUser, Request $request, $provider = null)
{
if (is_null($provider)) {
return view(Config('constants.frontView') . '.login');
} else {
return $authenticateUser->execute(Request::all(), $this, $provider);
}
}
示例11: setArrayConfigProxy
protected function setArrayConfigProxy($keyConfigProxy = 'proxy')
{
$this->configProxy = [];
if (class_exists('Config') && !is_null(Config($keyConfigProxy))) {
//Verificação para config class do Laravel
$this->configProxy = Config($keyConfigProxy);
}
return $this;
}
示例12: __construct
public function __construct()
{
$this->charset = Config('CODE_CHARSET');
$this->codelen = Config('CODE_LENGTH');
$this->width = Config('CODE_WIDTH');
$this->height = Config('CODE_HEIGHT');
$this->fontsize = Config('CODE_FONTSIZE');
$this->font = Config('CODE_FONTPATH');
}
示例13: templateName
public function templateName()
{
$template = Config('lara-cms.master.template');
if (isset($template[$this->template])) {
return $template[$this->template];
} else {
return null;
}
}
示例14: getKey
public function getKey()
{
$mac = shell_exec("ifconfig | awk '/eth/{print \$5}'");
$ip = trim(`ifconfig eth0|grep -oE '([0-9]{1,3}\\.?){4}'|head -n 1`);
$mac = trim(str_replace(':', '.', $mac));
$domain = trim(str_replace(':', '.', \Config('app.www_domain')));
$key = $domain . ':' . $mac . ':' . \Config('app.application_name') . ':' . (empty($_SESSION['enterprise_id']) ? 'sys' : $_SESSION['enterprise_id']);
return $key;
}
示例15: edit
public function edit()
{
// dd(Helper::test());
$attrs = Attribute::find(Input::get('id'));
$attrSets = AttributeSet::get(['id', 'attr_set'])->toArray();
$attr_types = AttributeType::all();
$action = route("admin.attrs.save");
return view(Config('constants.adminAttrView') . '.addEdit', compact('attrs', 'attrSets', 'action', 'attr_types'));
}