本文整理汇总了PHP中includeIfExists函数的典型用法代码示例。如果您正苦于以下问题:PHP includeIfExists函数的具体用法?PHP includeIfExists怎么用?PHP includeIfExists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了includeIfExists函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runBehatCommand
/**
* Run behat original command
*
* @param array $args
*/
private function runBehatCommand(array $args = array())
{
define('BEHAT_BIN_PATH', $this->getContainer()->getParameter('kernel.root_dir') . '/../bin/behat');
function includeIfExists($file)
{
if (file_exists($file)) {
return include $file;
}
}
if (!($loader = includeIfExists($this->getContainer()->getParameter('kernel.root_dir') . '/../vendor/autoload.php')) && !($loader = includeIfExists($container->getParameter('kernel.root_dir') . '/../../../../autoload.php'))) {
fwrite(STDERR, 'You must set up the project dependencies, run the following commands:' . PHP_EOL . 'curl -s http://getcomposer.org/installer | php' . PHP_EOL . 'php composer.phar install' . PHP_EOL);
exit(1);
}
$factory = new ApplicationFactory();
$factory->createApplication()->run(new ArrayInput($args));
}
示例2: includeIfExists
<?php
/*
* This file is part of composer/statis.
*
* (c) Composer <https://github.com/composer>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
function includeIfExists($file)
{
if (file_exists($file)) {
return include $file;
}
}
if (!($loader = includeIfExists(__DIR__ . '/../vendor/autoload.php')) && !($loader = includeIfExists(__DIR__ . '/../../../autoload.php'))) {
print 'You must set up the project dependencies, run the following commands:' . PHP_EOL . 'curl -s http://getcomposer.org/installer | php' . PHP_EOL . 'php composer.phar install' . PHP_EOL;
die(1);
}
return $loader;
示例3: includeIfExists
<?php
/**
* This file is part of the "cosma/testing-bundle" project
*
* (c) Cosmin Voicu<cosmin.voicu@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* Date: 11/07/14
* Time: 23:33
*/
function includeIfExists($file)
{
if (file_exists($file)) {
return include $file;
}
}
if (!($loader = includeIfExists(__DIR__ . '/../vendor/autoload.php')) && !($loader = includeIfExists(__DIR__ . '/../../../../../autoload.php'))) {
die('You must set up the project dependencies, run the following commands:' . PHP_EOL . 'curl -s http://getcomposer.org/installer | php' . PHP_EOL . 'php composer.phar install' . PHP_EOL);
}
includeIfExists(__DIR__ . '/Entities.php');
$loader->add('Cosma\\Bundle\\TestingBundle\\', __DIR__);
示例4: includeIfExists
<?php
/**
* Inclur file php if exists
* @param $file
* @return bool|mixed
*/
function includeIfExists($file)
{
return file_exists($file) ? include $file : false;
}
// Try loading the file vendor/autoload.php
$loader = includeIfExists(__DIR__ . '/../vendor/autoload.php');
if ($loader !== false) {
return $loader;
}
// Try loading the file autoload.php
$loader = includeIfExists(__DIR__ . '/../../vendor/autoload.php');
if ($loader !== false) {
return $loader;
}
// Shor message
echo 'You must set up the project dependencies, run the following commands:' . PHP_EOL . 'php consolle.phar install' . PHP_EOL;
exit(1);
示例5: error_reporting
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
function includeIfExists($file)
{
return file_exists($file) ? include $file : false;
}
if (!includeIfExists(__DIR__ . '/../vendor/autoload.php')) {
echo 'You must set up the project dependencies, run the following commands:' . PHP_EOL . 'curl -sS https://getcomposer.org/installer | php' . PHP_EOL . 'php composer.phar install' . PHP_EOL;
exit(1);
}
示例6: includeIfExists
<?php
/*
* This file is part of Satis.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Drupal\ParseComposer;
function includeIfExists($file)
{
if (file_exists($file)) {
return include $file;
}
}
if (!includeIfExists(__DIR__ . '/vendor/drupal/drupal/includes/common.inc') && !includeIfExists(__DIR__ . '/../../drupal/drupal/includes/common.inc')) {
die('You must set up the project dependencies, run the following commands:' . PHP_EOL . 'curl -s http://getcomposer.org/installer | php' . PHP_EOL . 'php composer.phar install' . PHP_EOL);
}
示例7: includeIfExists
<?php
function includeIfExists($file)
{
if (file_exists($file)) {
return include $file;
}
}
$vendor = realpath(__DIR__ . '/../vendor');
if (!($loader = includeIfExists($vendor . '/autoload.php'))) {
die('You must set up the project dependencies, run the following commands:' . PHP_EOL . 'curl -s http://getcomposer.org/installer | php' . PHP_EOL . 'php composer.phar install' . PHP_EOL);
}
$loader->add('Ali', __DIR__);