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


PHP getenv函数代码示例

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


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


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