当前位置: 首页>>代码示例>>PHP>>正文


PHP exists函数代码示例

本文整理汇总了PHP中exists函数的典型用法代码示例。如果您正苦于以下问题:PHP exists函数的具体用法?PHP exists怎么用?PHP exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 protected function render()
 {
     try {
         $prop = $this->props;
         $services = $prop->service ?: $prop->services;
         if ($services) {
             $vm = $this->context->getDataBinder()->getViewModel();
             $injector = $this->context->injector;
             $aliases = preg_split('/\\s+/', $services, -1, PREG_SPLIT_NO_EMPTY);
             if (exists($as = $prop->as)) {
                 if (count($aliases) > 1) {
                     throw new ComponentException($this, "When using the <kbd>as</kbd> property, you can only specify one value for the <kbd>service</kbd> property");
                 }
                 $service = $injector->make($services);
                 $vm->{$as} = $service;
             } else {
                 foreach ($aliases as $alias) {
                     $service = $injector->get($alias);
                     $vm->{$alias} = $service;
                 }
             }
         }
     } catch (NotFoundException $e) {
         throw new ComponentException($this, $e->getMessage());
     }
 }
开发者ID:electro-modules,项目名称:matisse,代码行数:26,代码来源:Import.php

示例2: __isset

 public function __isset()
 {
     if (exists($this->color)) {
         return TRUE;
     }
     return FALSE;
 }
开发者ID:MetalMor,项目名称:ExM7UF1,代码行数:7,代码来源:Cotxe.php

示例3: getImageUrl

 public function getImageUrl($path, array $params = [])
 {
     if (exists($path)) {
         return rtrim(substr($this->urlBuilder->getUrl($path, $params), 1), '?');
     }
     return '';
 }
开发者ID:electro-framework,项目名称:framework,代码行数:7,代码来源:ContentRepository.php

示例4: getImplementationType

 function getImplementationType()
 {
     global $zuckerreports_config;
     if ($zuckerreports_config["team_implementation"] == "auto") {
         if (file_exists("modules/Teams/Team.php")) {
             return "sugar";
         } else {
             if (!empty($zuckerreports_config["teams"])) {
                 return "simple";
             } else {
                 return "none";
             }
         }
     } else {
         if ($zuckerreports_config["team_implementation"] == "sugar" && exists("modules/Teams/Team.php")) {
             return "sugar";
         } else {
             if ($zuckerreports_config["team_implementation"] == "simple") {
                 return "simple";
             } else {
                 return "none";
             }
         }
     }
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:25,代码来源:SimpleTeams.php

示例5: evaluate

 protected function evaluate()
 {
     $prop = $this->props;
     $np = Parser::NAMELESS_PROP;
     if (isset($prop->{$np})) {
         if ($prop->{$np}) {
             //      if ($prop->getComputed($np))
             return $this->getChildren();
         }
         return $this->getChildren('else');
     }
     $v = $prop->get('value');
     $not = $prop->not;
     if (exists($prop->matches)) {
         if (preg_match("%{$prop->matches}%", $v) xor $not) {
             return $this->getChildren();
         }
         return $this->getChildren('else');
     }
     if ($prop->case) {
         foreach ($prop->case as $param) {
             if ($v == $param->props->is) {
                 return $param->getChildren();
             }
         }
         return $this->getChildren('else');
     }
     if (toBool($v) xor $not) {
         return $this->getChildren();
     }
     return $this->getChildren('else');
 }
开发者ID:electro-modules,项目名称:matisse,代码行数:32,代码来源:If_.php

示例6: getError

 private function getError($item)
 {
     if (exists($this->errors[$item])) {
         return $this->errors[$item];
     } else {
         return "";
     }
 }
开发者ID:Fralleee,项目名称:frallemvc,代码行数:8,代码来源:Validate.php

示例7: makeBody

 function makeBody($content = '', $stream = 'php://memory')
 {
     $s = new Stream($stream, 'wb+');
     if (exists($content)) {
         $s->write($content);
     }
     return $s;
 }
开发者ID:electro-framework,项目名称:framework,代码行数:8,代码来源:ResponseFactory.php

示例8: isLoggedIn

function isLoggedIn()
{
    if (!empty($_SESSION['logged_in']) && exists($connection, 'user_id', 'users', 'user_id', $_SESSION['logged_in']) == true) {
        return true;
    } else {
        return false;
    }
}
开发者ID:AoifeNiD,项目名称:phpNightmareChanged,代码行数:8,代码来源:user1.inc.php

示例9: testUnPlug

 public function testUnPlug()
 {
     $class = __NAMESPACE__ . '\\FakePlug';
     plug('fake', [_CLASS => $class]);
     $this->assertTrue(exists('fake', 'PlugIn'));
     unPlug('fake');
     $this->assertFalse(exists('fake', 'PlugIn'));
 }
开发者ID:pmvc,项目名称:pmvc,代码行数:8,代码来源:UtilPlugTest.php

示例10: render

 protected function render()
 {
     $prop = $this->props;
     $scopeProps = $this->getDataBinder()->getProps();
     $name = $prop->name;
     if (isset($scopeProps) && !exists($scopeProps->{$name})) {
         $scopeProps->{$name} = $prop->default;
     }
 }
开发者ID:electro-modules,项目名称:matisse,代码行数:9,代码来源:MacroParam.php

示例11: render

 /**
  * Registers a stylesheet on the Page.
  */
 protected function render()
 {
     $prop = $this->props;
     if (exists($prop->src)) {
         $this->context->getAssetsService()->addStylesheet($prop->src, $this->props->prepend);
     } else {
         if ($this->hasChildren()) {
             $this->context->getAssetsService()->addInlineCss($this, $prop->name, $this->props->prepend);
         }
     }
 }
开发者ID:electro-modules,项目名称:matisse,代码行数:14,代码来源:Style.php

示例12: viewModel

 protected function viewModel(ViewModel $viewModel)
 {
     $settings = $viewModel->adminSettings = $this->adminSettings;
     if ($settings->showMenu()) {
         $target = $settings->topMenuTarget();
         $viewModel->topMenu = exists($target) ? isset($this->navigation[$target]) ? $this->navigation[$target] : null : $this->navigation;
     }
     $viewModel->sideMenu = get($this->navigation->getCurrentTrail($settings->sideMenuOffset()), 0);
     $user = $this->session->user();
     $viewModel->devMode = $user && $user->roleField() == UserInterface::USER_ROLE_DEVELOPER;
 }
开发者ID:selene-framework,项目名称:admin-module,代码行数:11,代码来源:Main.php

示例13: test_exists

 function test_exists()
 {
     $this->assertTrue(exists($GLOBALS['_name']));
     $foo = '';
     $bar = array();
     $this->assertFalse(exists($foo));
     $this->assertFalse(exists($bar));
     $this->assertEqual(use_default('', 'foo'), 'foo');
     $this->assertEqual(use_default('bar', 'foo'), 'bar');
     $this->assertNotEqual(use_default('bar', 'foo'), 'foo');
     $this->assertNotEqual(use_default('', 'foo'), '');
 }
开发者ID:gruner,项目名称:doozer,代码行数:12,代码来源:TestFramework.php

示例14: render

 protected function render()
 {
     $viewModel = $this->getViewModel();
     $prop = $this->props;
     $count = $prop->get('count', -1);
     if (exists($prop->each)) {
         $this->parseIteratorExp($prop->each, $idxVar, $itVar);
     } else {
         $idxVar = $itVar = null;
     }
     if (!is_null($for = $prop->of)) {
         $first = true;
         foreach ($for as $i => $v) {
             if ($idxVar) {
                 $viewModel->{$idxVar} = $i;
             }
             $viewModel->{$itVar} = $v;
             if ($first) {
                 $first = false;
                 $this->runChildren('header');
             } else {
                 $this->runChildren('glue');
             }
             $this->runChildren();
             if (!--$count) {
                 break;
             }
         }
         if ($first) {
             $this->runChildren('noData');
         } else {
             $this->runChildren('footer');
         }
         return;
     }
     if ($count > 0) {
         for ($i = 0; $i < $count; ++$i) {
             $viewModel->{$idxVar} = $viewModel->{$itVar} = $i;
             if ($i == 0) {
                 $this->runChildren('header');
             } else {
                 $this->runChildren('glue');
             }
             $this->runChildren();
         }
         if ($i) {
             $this->runChildren('footer');
             return;
         }
     }
     $this->runChildren('noData');
 }
开发者ID:electro-modules,项目名称:matisse,代码行数:52,代码来源:For_.php

示例15: addInlineScript

 /**
  * Adds an inline script to the HEAD section of the page.
  *
  * @param string|RenderableInterface $code    Javascript code without the script tags.
  * @param string                     $name    An identifier for the script, to prevent duplication.
  *                                            When multiple scripts with the same name are added, only the last one is
  *                                            considered.
  * @param bool                       $prepend If true, prepend to current list instead of appending.
  * @return $this
  */
 function addInlineScript($code, $name = null, $prepend = false)
 {
     if (exists($name)) {
         $this->assets->inlineScripts[$name] = $code;
     } else {
         if ($prepend) {
             array_unshift($this->assets->inlineScripts, $code);
         } else {
             $this->assets->inlineScripts[] = $code;
         }
     }
     return $this;
 }
开发者ID:electro-framework,项目名称:framework,代码行数:23,代码来源:AssetsService.php


注:本文中的exists函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。