本文整理汇总了PHP中getEnv函数的典型用法代码示例。如果您正苦于以下问题:PHP getEnv函数的具体用法?PHP getEnv怎么用?PHP getEnv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getEnv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: teamLeaderSelect
function teamLeaderSelect($area, $selected)
{
$url = getEnv('PERMISSIONSURL');
// Ask the permission microservice which groups' users can be team leaders
$groups = sendAuthenticatedRequest("GET", $url . "/permission/verbs/28e60394-f719-4225-85ad-fa542ab6a8df/lead");
$teamLeads = array();
// loop through groups and get users
for ($i = 0; $i < count($groups["data"]); $i++) {
$users = sendAuthenticatedRequest("GET", $url . "/groupMembers/" . $groups["data"][$i]["Guid"]);
for ($j = 0; $j < count($users["data"]); $j++) {
if (!in_array($users["data"][$j], $teamLeads)) {
$teamLeads[] = $users["data"][$j];
}
}
}
$count = 0;
for ($i = 0; $i < count($teamLeads); $i++) {
if ($teamLeads[$i] == $selected) {
echo "<option value='" . $teamLeads[$i] . "' selected>" . nameByNetId($teamLeads[$i]) . "</option>";
} else {
$count++;
echo "<option value='" . $teamLeads[$i] . "'>" . nameByNetId($teamLeads[$i]) . "</option>";
}
}
// If the selected team lead was not pulled add him/her
if (count($teamLeads) == $count) {
echo "<option value='" . $selected . "' selected>" . nameByNetId($selected) . "</option>";
}
}
示例2: __construct
public function __construct($arguments)
{
ini_set('display_errors', TRUE);
error_reporting(E_ALL);
$this->arguments = new Hymn_Arguments($arguments, $this->baseArgumentOptions);
self::$fileName = $this->arguments->getOption('file');
try {
if (getEnv('HTTP_HOST')) {
throw new RuntimeException('Access denied');
}
$action = $this->arguments->getArgument();
if ($this->arguments->getOption('help')) {
array_unshift($arguments, "help");
$this->arguments = new Hymn_Arguments($arguments, $this->baseArgumentOptions);
} else {
if ($this->arguments->getOption('version')) {
array_unshift($arguments, "version");
$this->arguments = new Hymn_Arguments($arguments, $this->baseArgumentOptions);
}
}
if (!in_array($action, array('help', 'create', 'version'))) {
$this->readConfig();
$this->loadLibraries();
// $this->setupDatabaseConnection();
}
$this->dispatch();
// self::out();
} catch (Exception $e) {
self::out("Error: " . $e->getMessage());
}
}
示例3: client
/**
* @return \Codesmith\TsysTransItSDK\Connection
*/
protected function client()
{
if ($this->client) {
return $this->client;
}
return $this->client = new \Codesmith\TsysTransItSDK\Connection(['mid' => getEnv('mid'), 'userID' => getEnv('userID'), 'password' => getEnv('password'), 'transKey' => getEnv('transactionKey')]);
}
示例4: newGuid
/**
* Generates a new guid by calling out to the guid-generator micro-service, or
* if it can't be hit, generates one on it's own
*
* @return A new v4 guid
*/
public function newGuid()
{
$url = getEnv('GUIDURL');
if ($url == "") {
$url = "http://tmt-guid.byu.edu";
}
// Start building curl options
$curl_options = array();
$curl_options[CURLOPT_URL] = $url . '/guid';
$curl_options[CURLOPT_RETURNTRANSFER] = true;
// Create handle and set options
$curl_handle = curl_init();
$success = curl_setopt_array($curl_handle, $curl_options);
// Check failure to properly prepare curl handle
if (!$success) {
curl_close($curl_handle);
return $this->newGuidLocal();
}
// Execute request
$response = curl_exec($curl_handle);
// Check for errors
$http_code = curl_getinfo($curl_handle, CURLINFO_HTTP_CODE);
$err_num = curl_errno($curl_handle);
// Failed to hit micro-service
if ($http_code < 200 || $http_code >= 400 || $err_num != 0) {
curl_close($curl_handle);
return $this->newGuidLocal();
}
// Parse response and return
$response = json_decode($response, false);
$guid = $response->data;
curl_close($curl_handle);
return $guid;
}
示例5: __construct
public function __construct()
{
parent::__construct();
$this->url = getEnv('GUIDURL');
if ($this->url == "") {
$this->url = "http://tmt-guid.byu.edu";
}
}
示例6: getLogDir
public function getLogDir()
{
if (false !== getEnv('OPENSHIFT_LOG_DIR')) {
return getEnv('OPENSHIFT_LOG_DIR');
} else {
return parent::getLogDir();
}
}
示例7: loadEnvVariables
public function loadEnvVariables()
{
self::loadDotenv();
self::$host = getEnv('DB_HOST');
self::$name = getEnv('DB_NAME');
self::$username = getEnv('DB_USERNAME');
self::$password = getEnv('DB_PASSWORD');
}
示例8: should_generate_a_valid_transaction_key
/** @test */
public function should_generate_a_valid_transaction_key()
{
$res = $this->client()->generateKey(['mid' => getEnv('mid'), 'userID' => getEnv('userID'), 'password' => getEnv('password')]);
$this->log(__METHOD__, $res);
$this->assertArrayHasKey('status', $res);
$this->assertEquals('PASS', $res['status']);
$this->assertContains($res['responseCode'], array_keys($this->client()->approvedCodes));
}
示例9: __construct
public function __construct()
{
$bddCon = mysqli_connect(getEnv('DB_HOST'), getEnv('DB_USER'), getEnv('DB_PASSWORD'), getEnv('DB_NAME'));
if (!$bddCon) {
die("Nous sommes désolé : La connexion à la base de données à échouée ...");
} else {
$this->bdd = $bddCon;
}
}
示例10: __construct
public function __construct()
{
$dbCon = mysqli_connect(getEnv("DB_HOST"), getEnv("DB_USERNAME"), getEnv("DB_PASSWORD"), getEnv("DB_NAME"));
if (!$dbCon) {
die("Nous sommes désolé : La connexion à la base de données à échouée ...");
} else {
$this->db = $dbCon;
}
}
示例11: clientIPToHex
function clientIPToHex($ip="") {
$hex="";
if($ip=="") $ip=getEnv("REMOTE_ADDR");
$part=explode('.', $ip);
for ($i=0; $i<=count($part)-1; $i++) {
$hex.=substr("0".dechex($part[$i]),-2);
}
return $hex;
}
示例12: ___onCheckAccess
static public function ___onCheckAccess( $env, $module, $context, $data = array() ){
$allowUnsecuredLocalhost = !TRUE;
$isAuthorized = (bool) $env->getRequest()->getHeader( 'Authorization', FALSE );
$isLocalhost = getEnv( 'HTTP_HOST' ) === "localhost";
$isSecured = $isAuthorized || ( $isLocalhost && $allowUnsecuredLocalhost );
if( !$isSecured ){
$message = 'This Hydra instance is not secured by HTTP Basic Authentication. Please fix this!';
$env->getMessenger()->noteFailure( $message );
}
}
示例13: loadEnvVariables
public static function loadEnvVariables()
{
if (!getenv('APP_ENV')) {
self::loadDotenv();
}
self::$host = getEnv('DB_HOST');
self::$name = getEnv('DB_NAME');
self::$username = getEnv('DB_USERNAME');
self::$password = getEnv('DB_PASSWORD');
self::$connection = getEnv('DB_CONNECTION');
}
示例14: setUp
public function setUp()
{
parent::setUp();
try {
$dotenv = new Dotenv\Dotenv(dirname(__DIR__));
$dotenv->load();
} catch (Exception $e) {
exit('Could not find a .env file.');
}
$this->faker = Faker\Factory::create();
$this->object = new PaymentVault(['store-id' => getEnv('PROFIT_STARS_STORE_ID'), 'store-key' => getEnv('PROFIT_STARS_STORE_KEY'), 'entity-id' => getEnv('PROFIT_STARS_ENTITY_ID'), 'location-id' => getEnv('PROFIT_STARS_LOCATION_ID')]);
}
示例15: common_header
function common_header($title = "")
{
/* Can't open socket on sourceforge.net, I have to point the demo to my site */
$host = getEnv("HTTP_HOST") == "canship.sourceforge.net" ? "http://www.allaboutweb.ca/sf/canship/" : "";
?>
<html>
<head>
<title><?php
print $title ? "Canada Post Shipping Rate Calculator - A Free PHP Shipping Tool | {$title}" : "";
?>
</title>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="main.css">
<meta name="keywords" content="Shipping Calculator, Rate Calculator, Calculation, eParcel, Canada Post, PHP, Shipping Module, eBay, Merchant Tools, e-Commerce, Online Shopping, Online Transaction, Real time, Shipping Quote, XML, Web Service, Free Shipping, Shipping Quoter, Open Source, osCommerce, Shopping Cart, Vancouver, British Columbia, Shopping Basket, Package, Free Packaging, Width, Height, Weight, Length, International, Domestic,USA, Fedex, UPS,Expedited, Xpresspost,Priority Courier,Air Parcel, Surface, Sell Online, API, French, Shipping Rate ">
<meta name="description" content="
Canada Post Shipping Rate Calculator - A free PHP shipping calculator for all shipping purpose, including eBay merchants, ecommerce sites.
This tool is developed by using API of Sell Online(tm) Shipping Module from Canada Post. Once you get a retail account from Canada Post,
you can setup your shipping profile throught their backend.
">
</head>
<body bgcolor="#ffffff" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0">
<table border="0" cellpadding="10" cellspacing="0" bgcolor="#ff0000" width="100%">
<tr valign="middle">
<td nowrap><img src="pics/canadapost.gif" width="178" height="60" alt="" border="0"></td>
<td width="100%"><font color="#ffffff" class="pageTitle">Free PHP Canada Post Shipping Rate Calculator</font></td>
</tr>
</table>
<table border="0" cellpadding="5" cellspacing="0" width="100%" >
<tr>
<td nowrap>[ <a href="index.php">Home</a> ]</td>
<td nowrap>[ <a href="<?php
echo $host;
?>
ebay.demo.php">eBay Demo</a> ]</td>
<td nowrap>[ <a href="<?php
echo $host;
?>
developer.demo.php">Developer Demo</a> ]</td>
<td nowrap>[ <a href="merchant_tool.php">Merchant Tool</a> ]</td>
<td nowrap>[ <a href="download.php">Download</a> ]</td>
<td nowrap>[ <a href="index.php#contact">Contact</a> ]</td>
<td width="100%"> </td>
</tr>
</table>
<br><br>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td >
<!-- --------------- Begin: Main Content -------------------------------- -->
<?php
}