• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP exists函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: loadModel

 function loadModel($modelClass, $subModelPath = '', $id = null)
 {
     $id = $this->requestedId ?: $id;
     $this->requestedId = $id;
     /** @var Model $modelClass */
     $model = exists($id) ? $modelClass::query()->findOrFail($id) : new $modelClass();
     if ($subModelPath === '') {
         $this->model = $model;
     } else {
         setAt($this->model, $subModelPath, $model);
     }
     return $model;
 }
开发者ID:electro-modules,项目名称:illuminate-database,代码行数:13,代码来源:ModelController.php


示例17: makeOptions

 /**
  * Generates a javascript representation of the provided options, stripping the ones that are null or empty strings.
  *
  * @param array  $options A map of options.
  * @param string $indent  Indentation level, composed of spaces.
  * @return string
  */
 static function makeOptions(array $options, $indent = '')
 {
     $o = mapAndFilter($options, function ($v, $k) use($indent) {
         if (is_object($v)) {
             if (method_exists($v, 'toArray')) {
                 $v = $v->toArray();
             } else {
                 $v = (array) $v;
             }
         }
         return exists($v) ? "{$k}: " . json_encode($v, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) : null;
     });
     return "{\n{$indent}  " . implode(",\n{$indent}  ", $o) . "\n{$indent}}";
 }
开发者ID:electro-modules,项目名称:matisse,代码行数:21,代码来源:JavascriptCodeGen.php


示例18: register

function register()
{
    if (empty($_POST["first_name"]) || empty($_POST["last_name"])) {
        $GLOBALS["errors"]["noName"] = "You need to enter your first and last name";
    }
    if (empty($_POST["country"])) {
        $GLOBALS["errors"]["noCountry"] = "You need to enter the country that you live in";
    }
    if (empty($_POST["city"])) {
        $GLOBALS["errors"]["noCity"] = "You need to enter the city that you live in";
    }
    if (empty($_POST["password"])) {
        $GLOBALS["errors"]["noPassword"] = "You need to enter a password";
    }
    if ($_POST["password"] !== $_POST["password2"]) {
        $GLOBALS["errors"]["passwordMatch"] = "Passwords don't match";
    }
    if (empty($_POST["email"])) {
        $GLOBALS["errors"]["noEmail"] = "You need to enter your email address";
    }
    if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
        $GLOBALS["errors"]["notValidEmail"] = "You need to enter a valid email address";
    }
    if (empty($_POST["phone"])) {
        $GLOBALS["errors"]["noPhone"] = "You need to enter your phone number";
    }
    //Checking if the email has already registered
    if (exists("email", $_POST["email"])) {
        $GLOBALS["errors"]["emailRegistered"] = "A user with that email has already registered";
    }
    if (empty($GLOBALS["errors"])) {
        //I shouldn't use this hash function, but I will for now. I should really use password_hash()
        $password = password_hash($_POST["password"], PASSWORD_DEFAULT);
        $country = $_POST["country"];
        $city = $_POST["city"];
        $full_name = $_POST["first_name"] . " " . $_POST["last_name"];
        $email = $_POST["email"];
        $phone = $_POST["phone"];
        $query = "INSERT INTO users (country, city, password, full_name, email, phone) VALUES (?, ?, ?, ?, ?, ?)";
        $stmt = $GLOBALS["conn"]->prepare($query);
        if (!$stmt) {
            echo "Error: " . $GLOBALS["conn"]->error;
        }
        $stmt->bind_param("sssssi", $country, $city, $password, $full_name, $email, $phone);
        $stmt->execute();
        $stmt->close();
        $GLOBALS["success_message"] = "Registration successful!";
    }
}
开发者ID:Trettman,项目名称:BloggMe,代码行数:49,代码来源:login.php


示例19: preRender

 protected function preRender()
 {
     $prop = $this->props;
     // Output a hidden checkbox that will submit an empty value if the visible checkbox is not checked.
     // Does not apply to checkboxes of array fields.
     if (exists($prop->name) && !str_endsWith($prop->name, '[]')) {
         echo "<input type=checkbox name=\"{$prop->name}\" value=\"\" checked style=\"display:none\">";
     }
     $id = property($prop, 'id');
     if ($id) {
         $prop->containerId = $prop->id . 'Container';
     }
     echo "<!--CHECKBOX-->";
     parent::preRender();
 }
开发者ID:electro-modules,项目名称:matisse-components,代码行数:15,代码来源:Checkbox.php


示例20: startUp

 static function startUp(KernelInterface $kernel, ModuleInfo $moduleInfo)
 {
     $kernel->onConfigure(function (MatisseSettings $matisseSettings, ModelControllerInterface $modelController, InjectorInterface $injector, ContentServerSettings $contentServerSettings, AssetsService $assetsService) use($moduleInfo) {
         $matisseSettings->registerMacros($moduleInfo)->registerComponents(['Button' => C\Button::class, 'Checkbox' => C\Checkbox::class, 'DataGrid' => C\DataGrid::class, 'Dropzone' => C\Dropzone::class, 'Field' => C\Field::class, 'FileUpload' => C\FileUpload::class, 'HtmlEditor' => C\HtmlEditor::class, 'Image' => C\Image::class, 'ImageField' => C\ImageField::class, 'Input' => C\Input::class, 'Label' => C\Label::class, 'Link' => C\Link::class, 'MainMenu' => C\MainMenu::class, 'NavigationPath' => C\NavigationPath::class, 'Paginator' => C\Paginator::class, 'RadioButton' => C\RadioButton::class, 'Select' => C\Select::class, 'Switch' => C\Switch_::class, 'Tab' => C\Tab::class, 'TabPage' => C\TabPage::class, 'Tabs' => C\Tabs::class]);
         $assetsService->registerAssets($moduleInfo->name, ['dist/components.css']);
         $modelController->registerExtension($injector->makeFactory(ImageFieldHandler::class));
         File::deleting(function (File $model) use($contentServerSettings, $injector) {
             if (exists($model->path)) {
                 $path = "{$contentServerSettings->fileArchivePath()}/{$model->path}";
                 if (file_exists($path)) {
                     unlink($path);
                 }
                 $glideServer = $injector->make(Server::class);
                 $glideServer->deleteCache($model->path);
             }
         });
     });
 }
开发者ID:electro-modules,项目名称:matisse-components,代码行数:18,代码来源:MatisseComponentsModule.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP exists_auth_plugin函数代码示例发布时间:2022-05-15
下一篇:
PHP existeSql函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap