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

PHP getenv函数代码示例

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

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



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

示例1: find

 public function find()
 {
     if (defined('HHVM_VERSION') && false !== ($hhvm = getenv('PHP_BINARY'))) {
         return $hhvm;
     }
     if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server')) && is_file(PHP_BINARY)) {
         return PHP_BINARY;
     }
     if ($php = getenv('PHP_PATH')) {
         if (!is_executable($php)) {
             return false;
         }
         return $php;
     }
     if ($php = getenv('PHP_PEAR_PHP_BIN')) {
         if (is_executable($php)) {
             return $php;
         }
     }
     $dirs = array(PHP_BINDIR);
     if (defined('PHP_WINDOWS_VERSION_BUILD')) {
         $dirs[] = 'C:\\xampp\\php\\';
     }
     return $this->executableFinder->find('php', false, $dirs);
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:25,代码来源:PhpExecutableFinder.php


示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     if (!getenv('RUN_OBJECTSTORE_TESTS')) {
         $this->markTestSkipped('objectstore tests are unreliable in some environments');
     }
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     // create users
     $users = array('test');
     foreach ($users as $userName) {
         \OC_User::deleteUser($userName);
         \OC_User::createUser($userName, $userName);
     }
     // main test user
     \OC_Util::tearDownFS();
     \OC_User::setUserId('');
     \OC\Files\Filesystem::tearDown();
     \OC_User::setUserId('test');
     $config = \OC::$server->getConfig()->getSystemValue('objectstore');
     $this->objectStorage = new ObjectStoreToTest($config['arguments']);
     $config['objectstore'] = $this->objectStorage;
     $this->instance = new ObjectStoreStorage($config);
 }
开发者ID:nem0xff,项目名称:core,代码行数:25,代码来源:swift.php


示例3: getBuddy

 /**
  * @return Buddy
  */
 public static function getBuddy()
 {
     if (!self::$buddy) {
         self::$buddy = new Buddy(['accessToken' => getenv('TOKEN_ALL')]);
     }
     return self::$buddy;
 }
开发者ID:buddy-works,项目名称:buddy-works-php-api,代码行数:10,代码来源:Utils.php


示例4: client

 /**
  * @return Client
  */
 protected function client()
 {
     if ($this->client === null) {
         $this->client = new Client(['apiKey' => getenv('REBILLY_API_KEY'), 'baseUrl' => getenv('REBILLY_API_HOST')]);
     }
     return $this->client;
 }
开发者ID:dara123,项目名称:integration-demo,代码行数:10,代码来源:Controller.php


示例5: postLogin

 public function postLogin(Request $request)
 {
     $this->validate($request, ['username' => 'required', 'password' => 'required']);
     $credentials = $request->only('username', 'password', 'active');
     $employee = Employee::where('username', $credentials['username'])->where('active', true)->first();
     if ($employee != null && password_verify($credentials['password'], $employee->password)) {
         if (!$employee->isadmin) {
             if (getenv('HTTP_X_FORWARDED_FOR')) {
                 $ip = getenv('HTTP_X_FORWARDED_FOR');
             } else {
                 $ip = getenv('REMOTE_ADDR');
             }
             $host = gethostbyaddr($ip);
             $ipAddress = 'Address : ' . $ip . ' Host : ' . $host;
             $count = Ipaddress::where('ip', $ip)->count();
             $today = date("Y-m-d");
             if ($count == 0 || $employee->loginstartdate == null || $today < date('Y-m-d', strtotime($employee->loginstartdate)) || $employee->loginenddate != null && $today > date('Y-m-d', strtotime($employee->loginenddate))) {
                 return view('errors.permissiondenied', ['ipAddress' => $ipAddress]);
             }
             if ($employee->branchid == null) {
                 return redirect($this->loginPath())->withInput($request->only('username', 'remember'))->withErrors(['username' => 'บัญชีเข้าใช้งานของคุณยังไม่ได้ผูกกับสาขา โปรดติดต่อหัวหน้า หรือผู้ดูแล']);
             }
         }
         if ($this->auth->attempt($credentials, $request->has('remember'))) {
             return redirect()->intended($this->redirectPath());
         }
     } else {
         return redirect($this->loginPath())->withInput($request->only('username', 'remember'))->withErrors(['username' => $this->getFailedLoginMessage()]);
     }
 }
开发者ID:x-Zyte,项目名称:nissanhippro,代码行数:30,代码来源:AuthController.php


示例6: configureMailer

 public function configureMailer()
 {
     $mail = new \PHPMailer();
     // $mail->SMTPDebug = 3;                               // Enable verbose debug output
     $mail->isSMTP();
     // Set mailer to use SMTP
     $mail->Host = getenv('EMAIL_SMTP');
     // Specify main and backup SMTP servers
     $mail->SMTPAuth = true;
     // Enable SMTP authentication
     $mail->Username = getenv('EMAIL_FROM');
     // SMTP username
     $mail->Password = getenv('EMAIL_FROM_PASSWORD');
     // SMTP password
     $mail->SMTPSecure = getenv('EMAIL_SMTP_SECURITY');
     // Enable TLS encryption, `ssl` also accepted
     $mail->Port = getenv('EMAIL_SMTP_PORT');
     // TCP port to connect to
     //From myself to myself (alter reply address)
     $mail->setFrom(getenv('EMAIL_FROM'), getenv('EMAIL_FROM_NAME'));
     $mail->addAddress(getenv('EMAIL_TO'), getenv('EMAIL_TO_NAME'));
     $mail->isHTML(true);
     // Set email format to HTML
     return $mail;
 }
开发者ID:jfortier,项目名称:ocr,代码行数:25,代码来源:ContactForm.php


示例7: trec_destruct

/**
 * Destructor cleanup for a test record
 *
 * @param Doctrine_Record $proto
 * @param string  $uuid
 */
function trec_destruct($proto, $uuid = null)
{
    if (!$uuid) {
        if (isset($proto->my_uuid)) {
            $uuid = $proto->my_uuid;
        } else {
            return;
            // nothing to delete
        }
    }
    // setup table vars
    $vars = trec_get_vars($proto);
    $tbl = $proto->getTable();
    $name = get_class($proto);
    $conn = $tbl->getConnection();
    // look for stale record
    $stale = $tbl->findOneBy($vars['UUID_COL'], $uuid);
    if ($stale && $stale->exists()) {
        if (getenv('AIR_DEBUG')) {
            diag("delete()ing stale {$name}: {$uuid}");
        }
        try {
            // ACTUALLY ... don't turn off key checks, to get cascading deletes
            //            $conn->execute('SET FOREIGN_KEY_CHECKS = 0');
            $stale->delete();
            //            $conn->execute('SET FOREIGN_KEY_CHECKS = 1');
        } catch (Exception $err) {
            diag($err);
        }
    }
    // put UUID back on the stack
    $vars['UUIDS'][] = $uuid;
}
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:39,代码来源:trec_utils.php


示例8: hasColorSupport

 /**
  * Returns true if the stream supports colorization.
  *
  * Colorization is disabled if not supported by the stream:
  *
  *  -  Windows without Ansicon, ConEmu or Mintty
  *  -  non tty consoles
  *
  * @return bool true if the stream supports colorization, false otherwise
  */
 protected function hasColorSupport()
 {
     if (DIRECTORY_SEPARATOR === '\\') {
         return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM');
     }
     return function_exists('posix_isatty') && @posix_isatty($this->stream);
 }
开发者ID:edwardricardo,项目名称:zenska,代码行数:17,代码来源:StreamOutput.php


示例9: bindTextDomain

 public function bindTextDomain($domain, $path = '')
 {
     $file = $path . '/' . getenv('LANG') . '/LC_MESSAGES/' . $domain . '.ini';
     if (file_exists($file)) {
         $this->translations = parse_ini_file($file);
     }
 }
开发者ID:sundflux,项目名称:libvaloa,代码行数:7,代码来源:Ini.php


示例10: __construct

 public function __construct($apikey = null)
 {
     if (!$apikey) {
         $apikey = getenv('MANDRILL_APIKEY');
     }
     if (!$apikey) {
         $apikey = $this->readConfigs();
     }
     if (!$apikey) {
         throw new Mandrill_Error('You must provide a Mandrill API key');
     }
     $this->apikey = $apikey;
     $this->ch = curl_init();
     curl_setopt($this->ch, CURLOPT_USERAGENT, 'Mandrill-PHP/1.0.32');
     curl_setopt($this->ch, CURLOPT_POST, true);
     curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
     curl_setopt($this->ch, CURLOPT_HEADER, false);
     curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 30);
     curl_setopt($this->ch, CURLOPT_TIMEOUT, 600);
     $this->root = rtrim($this->root, '/') . '/';
     $this->templates = new Mandrill_Templates($this);
     $this->exports = new Mandrill_Exports($this);
     $this->users = new Mandrill_Users($this);
     $this->rejects = new Mandrill_Rejects($this);
     $this->inbound = new Mandrill_Inbound($this);
     $this->tags = new Mandrill_Tags($this);
     $this->messages = new Mandrill_Messages($this);
     $this->whitelists = new Mandrill_Whitelists($this);
     $this->internal = new Mandrill_Internal($this);
     $this->urls = new Mandrill_Urls($this);
     $this->webhooks = new Mandrill_Webhooks($this);
     $this->senders = new Mandrill_Senders($this);
 }
开发者ID:natar10,项目名称:SPC-Estandarizados,代码行数:34,代码来源:Mandrill.php


示例11: getIP

function getIP()
{
    if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
        $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
    } else {
        if (!empty($_SERVER["HTTP_CLIENT_IP"])) {
            $ip = $_SERVER["HTTP_CLIENT_IP"];
        } else {
            if (!empty($_SERVER["REMOTE_ADDR"])) {
                $ip = $_SERVER["REMOTE_ADDR"];
            } else {
                if (getenv("HTTP_X_FORWARDED_FOR")) {
                    $ip = getenv("HTTP_X_FORWARDED_FOR");
                } else {
                    if (getenv("HTTP_CLIENT_IP")) {
                        $ip = getenv("HTTP_CLIENT_IP");
                    } else {
                        if (getenv("REMOTE_ADDR")) {
                            $ip = getenv("REMOTE_ADDR");
                        } else {
                            $ip = "Unknown";
                        }
                    }
                }
            }
        }
    }
    return $ip;
}
开发者ID:00606,项目名称:cmge,代码行数:29,代码来源:function.php


示例12: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     self::$collection = uniqid('collection-');
     self::$client = new Client(getenv('ORCHESTRATE_API_KEY'));
     $kvPutOp = new KvPutOperation(self::$collection, uniqid(), json_encode(["name" => "Nick"]));
     $kvObject = self::$client->execute($kvPutOp);
 }
开发者ID:absynthe,项目名称:orchestrate-php-client,代码行数:7,代码来源:KvTest.php


示例13: fire

 /**
  * 计算黑水值
  * Execute the console command.
  * @return mixed
  */
 public function fire()
 {
     $i = 0;
     $black_water_val = (int) getenv('BLACK_WATER');
     while (true) {
         $result = UserBase::where('user_id', '>', $i)->orderBy('user_id', 'asc')->limit($this->limit)->get()->toArray();
         if (empty($result)) {
             break;
         }
         foreach ($result as $value) {
             $user_login_log = UserLoginLog::where('user_id', $value['user_id'])->where('date', date('Ymd', strtotime('-1 day')))->first();
             if (empty($user_login_log)) {
                 $user_black_water = new UserBlackWater();
                 $user_black_water_result = $user_black_water->where('user_id', $value['user_id'])->first();
                 if (empty($user_black_water_result)) {
                     $user_black_water->user_id = $value['user_id'];
                     $user_black_water->black_water = $black_water_val;
                     $user_black_water->save();
                 } else {
                     $user_black_water->where('user_id', $value['user_id'])->update(['black_water' => $user_black_water_result->black_water + $black_water_val]);
                 }
             }
             $i = $value['user_id'];
         }
     }
 }
开发者ID:xiongjiewu,项目名称:shui,代码行数:31,代码来源:CalculateTheBlackWater.php


示例14: setUp

 public function setUp()
 {
     $this->tmpdir = sys_get_temp_dir() . '/' . uniqid('conveyor');
     $this->projectdir = $this->tmpdir . '/project';
     $this->reposdir = $this->tmpdir . '/repos';
     $this->reposurl = 'file:///' . $this->reposdir;
     $this->filesystem = new Filesystem();
     $this->filesystem->mkdir($this->tmpdir);
     $this->filesystem->mkdir($this->projectdir);
     $svnadminbin = getenv('SVNADMIN_BIN') ? getenv('SVNADMIN_BIN') : '/usr/local/bin/svnadmin';
     $svnbin = getenv('SVN_BIN') ? getenv('SVN_BIN') : '/usr/local/bin/svn';
     if (!file_exists($svnadminbin)) {
         $this->markTestSkipped(sprintf('%s not found', $svnadminbin));
     }
     if (!file_exists($svnbin)) {
         $this->markTestSkipped(sprintf('%s not found', $svnbin));
     }
     $svnadmin = new Svnadmin($this->tmpdir, $svnadminbin);
     $svnadmin->create(basename($this->reposdir));
     $svn = new Svn($this->reposurl, new CliAdapter($svnbin, new Cli(), new CliParser()));
     $svn->import(__DIR__ . '/../Test/Fixtures/skeleton/svn/trunk', '/', 'imported skeleton');
     $svn->setHead(new Reference('2.1', Reference::TAG));
     $svn->import(__DIR__ . '/../Test/Fixtures/skeleton/svn/tags/2.1', '/', 'imported skeleton');
     $svn->setHead(new Reference('feature1', Reference::BRANCH));
     $svn->import(__DIR__ . '/../Test/Fixtures/skeleton/svn/branches/feature1', '/', 'imported skeleton');
     $content = file_get_contents(__DIR__ . '/../Test/Fixtures/conveyor.yml.twig');
     $content = str_replace('{{ repository.url }}', $this->reposurl, $content);
     file_put_contents($this->projectdir . '/conveyor.yml', $content);
     chdir($this->projectdir);
 }
开发者ID:webcreate,项目名称:conveyor,代码行数:30,代码来源:VersionsCommandTest.php


示例15: IPnya

function IPnya()
{
    $ipaddress = '';
    if (getenv('HTTP_CLIENT_IP')) {
        $ipaddress = getenv('HTTP_CLIENT_IP');
    } else {
        if (getenv('HTTP_X_FORWARDED_FOR')) {
            $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
        } else {
            if (getenv('HTTP_X_FORWARDED')) {
                $ipaddress = getenv('HTTP_X_FORWARDED');
            } else {
                if (getenv('HTTP_FORWARDED_FOR')) {
                    $ipaddress = getenv('HTTP_FORWARDED_FOR');
                } else {
                    if (getenv('HTTP_FORWARDED')) {
                        $ipaddress = getenv('HTTP_FORWARDED');
                    } else {
                        if (getenv('REMOTE_ADDR')) {
                            $ipaddress = getenv('REMOTE_ADDR');
                        } else {
                            $ipaddress = 'IP Tidak Dikenali';
                        }
                    }
                }
            }
        }
    }
    return $ipaddress;
}
开发者ID:Aghiel14,项目名称:Sistem-Oprasi,代码行数:30,代码来源:index.php


示例16: displayTemplateCallback

 function displayTemplateCallback($hookName, $args)
 {
     $templateMgr =& $args[0];
     $template =& $args[1];
     if ($template != 'article/article.tpl') {
         return false;
     }
     // Determine the query terms to use.
     $queryVariableNames = array('q', 'p', 'ask', 'searchfor', 'key', 'query', 'search', 'keyword', 'keywords', 'qry', 'searchitem', 'kwd', 'recherche', 'search_text', 'search_term', 'term', 'terms', 'qq', 'qry_str', 'qu', 's', 'k', 't', 'va');
     $this->queryTerms = array();
     if (($referer = getenv('HTTP_REFERER')) == '') {
         return false;
     }
     $urlParts = parse_url($referer);
     if (!isset($urlParts['query'])) {
         return false;
     }
     $queryArray = explode('&', $urlParts['query']);
     foreach ($queryArray as $var) {
         $varArray = explode('=', $var);
         if (in_array($varArray[0], $queryVariableNames) && !empty($varArray[1])) {
             $this->queryTerms += $this->parse_quote_string($varArray[1]);
         }
     }
     if (empty($this->queryTerms)) {
         return false;
     }
     $templateMgr->addStylesheet(Request::getBaseUrl() . '/' . $this->getPluginPath() . '/sehl.css');
     $templateMgr->register_outputfilter(array(&$this, 'outputFilter'));
     return false;
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:31,代码来源:SehlPlugin.inc.php


示例17: __testbench_database_setup

 /** @internal */
 public function __testbench_database_setup($connection, \Nette\DI\Container $container, $persistent = FALSE)
 {
     $config = $container->parameters['testbench'];
     $this->__testbench_databaseName = $config['dbprefix'] . getenv(\Tester\Environment::THREAD);
     $this->__testbench_database_drop($connection, $container);
     $this->__testbench_database_create($connection, $container);
     foreach ($config['sqls'] as $file) {
         \Kdyby\Doctrine\Dbal\BatchImport\Helpers::loadFromFile($connection, $file);
     }
     if ($config['migrations'] === TRUE) {
         if (class_exists(\Zenify\DoctrineMigrations\Configuration\Configuration::class)) {
             /** @var \Zenify\DoctrineMigrations\Configuration\Configuration $migrationsConfig */
             $migrationsConfig = $container->getByType(\Zenify\DoctrineMigrations\Configuration\Configuration::class);
             $migrationsConfig->__construct($container, $connection);
             $migrationsConfig->registerMigrationsFromDirectory($migrationsConfig->getMigrationsDirectory());
             $migration = new \Doctrine\DBAL\Migrations\Migration($migrationsConfig);
             $migration->migrate($migrationsConfig->getLatestVersion());
         }
     }
     if ($persistent === FALSE) {
         register_shutdown_function(function () use($connection, $container) {
             $this->__testbench_database_drop($connection, $container);
         });
     }
 }
开发者ID:mrtnzlml,项目名称:testbench,代码行数:26,代码来源:DoctrineConnectionMock.php


示例18: __construct

 /**
  * Constructs storage object and creates storage directory
  *
  * @param string $dir directory name to store data files in
  * @throws Zend_OpenId_Exception
  */
 public function __construct($dir = null)
 {
     if ($dir === null) {
         $tmp = getenv('TMP');
         if (empty($tmp)) {
             $tmp = getenv('TEMP');
             if (empty($tmp)) {
                 $tmp = "/tmp";
             }
         }
         $user = get_current_user();
         if (is_string($user) && !empty($user)) {
             $tmp .= '/' . $user;
         }
         $dir = $tmp . '/openid/provider';
     }
     $this->_dir = $dir;
     if (!is_dir($this->_dir)) {
         if (!@mkdir($this->_dir, 0700, 1)) {
             throw new Zend_OpenId_Exception("Cannot access storage directory {$dir}", Zend_OpenId_Exception::ERROR_STORAGE);
         }
     }
     if (($f = fopen($this->_dir . '/assoc.lock', 'w+')) === null) {
         throw new Zend_OpenId_Exception('Cannot create a lock file in the directory ' . $dir, Zend_OpenId_Exception::ERROR_STORAGE);
     }
     fclose($f);
     if (($f = fopen($this->_dir . '/user.lock', 'w+')) === null) {
         throw new Zend_OpenId_Exception('Cannot create a lock file in the directory ' . $dir, Zend_OpenId_Exception::ERROR_STORAGE);
     }
     fclose($f);
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:37,代码来源:File.php


示例19: testTitle

 public function testTitle()
 {
     $this->url('http://' . getenv("HEROKU_URL") . "/index.php");
     $this->screenshot($this->getName() . '-' . time() . '.png');
     $head = $this->byId('header');
     $this->assertEquals('Hello world, User!', $head->text());
 }
开发者ID:riivo,项目名称:sample-php-mysql-heroku,代码行数:7,代码来源:AcceptanceTest.php


示例20: aliases

 /**
  * Print and save drush aliases
  *
  * ## OPTIONS
  *
  * [--print]
  * : print aliases to screen
  *
  * [--location=<location>]
  * : Specify the the full path, including the filename, to the alias file
  *   you wish to create. Without this option a default of
  *   '~/.drush/pantheon.aliases.drushrc.php' will be used.
  */
 public function aliases($args, $assoc_args)
 {
     $user = Session::getUser();
     $print = $this->input()->optional(array('key' => 'print', 'choices' => $assoc_args, 'default' => false));
     $location = $this->input()->optional(array('key' => 'location', 'choices' => $assoc_args, 'default' => getenv('HOME') . '/.drush/pantheon.aliases.drushrc.php'));
     if (is_dir($location)) {
         $message = 'Please provide a full path with filename,';
         $message .= ' e.g. {location}/pantheon.aliases.drushrc.php';
         $this->failure($message, compact('location'));
     }
     $file_exists = file_exists($location);
     // Create the directory if it doesn't yet exist
     $dirname = dirname($location);
     if (!is_dir($dirname)) {
         mkdir($dirname, 0700, true);
     }
     $content = $user->getAliases();
     $h = fopen($location, 'w+');
     fwrite($h, $content);
     fclose($h);
     chmod($location, 0700);
     $message = 'Pantheon aliases created';
     if ($file_exists) {
         $message = 'Pantheon aliases updated';
     }
     if (strpos($content, 'array') === false) {
         $message .= ', although you have no sites';
     }
     $this->log()->info($message);
     if ($print) {
         $aliases = str_replace(array('<?php', '?>'), '', $content);
         $this->output()->outputDump($aliases);
     }
 }
开发者ID:karudonaldson,项目名称:terminus,代码行数:47,代码来源:SitesCommand.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP getext函数代码示例发布时间:2022-05-15
下一篇:
PHP getelementindexinarray函数代码示例发布时间: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