本文整理汇总了PHP中host函数的典型用法代码示例。如果您正苦于以下问题:PHP host函数的具体用法?PHP host怎么用?PHP host使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了host函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* load some required files
*/
function init()
{
parent::init();
$row = $this->member_get_oauth_type($this->type);
if (!$row->id) {
exit('access deny');
}
$this->oauth_id = $row->id;
$this->app_key = $row->key1;
$this->app_secret = $row->key2;
$this->url = host() . url('oauth/' . $this->type . '/return');
$files = array(base_path() . 'modules/oauth/libraries/alipay/alipay_core.function.php', base_path() . 'modules/oauth/libraries/alipay/alipay_md5.function.php', base_path() . 'modules/oauth/libraries/alipay/alipay_notify.class.php', base_path() . 'modules/oauth/libraries/alipay/alipay_submit.class.php');
Load::file($files);
$alipay_config['partner'] = $this->app_key;
//安全检验码,以数字和字母组成的32位字符
$alipay_config['key'] = $this->app_secret;
$alipay_config['sign_type'] = strtoupper('MD5');
//字符编码格式 目前支持 gbk 或 utf-8
$alipay_config['input_charset'] = strtolower('utf-8');
//ca证书路径地址,用于curl中ssl校验
//请保证cacert.pem文件在当前文件夹目录中
$alipay_config['cacert'] = base_path() . 'modules/oauth/libraries/alipay/cacert.pem';
//访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http
$alipay_config['transport'] = 'http';
$this->alipay_config = $alipay_config;
}
示例2: sendNotify
function sendNotify($userid, $msg, $link, $subject = null)
{
$umail = "noreply@wewanttotrade.com";
$ufname = "eDart";
$ulname = "User";
$domail = 1;
//PART I: Write to the database
$con = mysqli_connect(host(), username(), password(), mainDb());
$q = "INSERT INTO notify(`usr`,`date`,`message`,`link`) VALUES('" . mysqli_real_escape_string($con, $userid) . "','" . mysqli_real_escape_string($con, time()) . "','" . mysqli_real_escape_string($con, $msg) . "','" . mysqli_real_escape_string($con, $link) . "')";
//Insert a new row into the author's notifications
mysqli_query($con, $q);
//Execute
$user_call = new User(array("action" => "get", "id" => $userid));
$user_info = $user_call->run(true);
if (count($user_info) != 0) {
$user_info = $user_info[0];
$umail = $user_info["email"];
$ufname = ucwords($user_info["fname"]);
$ulname = ucwords($user_info["lname"]);
$domail = $user_info["do_mail"];
}
$greetings = array("Just wanted to let you know that:<br><br> %s. <br><br>That is all. Have a good rest of your day!", "In case you didn't know: <br><br>%s<br><br> Better go check it out.", "We hope you're having a good day! Just thought you might you want to know:<br><br> %s. <br><br>That is all. Carry on!", "Don't mean to break your flow, but we just thought you might want to know that<br><br> %s. <br><br>If you get the chance, you can check it out back at eDart. For now, live long and prosper!", "Hope your day is going splendidly! Just thought we'd let you know that:<br><br> %s. <br><br>When you have the time, check it out on eDart. Cool. For now, bye.");
$fullmsg = sprintf($greetings[rand(0, count($greetings) - 1)], $msg);
if ($subject == null) {
$subject = $msg;
}
//PART II: Send them an email
if ($domail == 1) {
sendMail($umail, $ufname, $ulname, $subject, $fullmsg, $link, "View on eDart");
}
}
示例3: return_url
/**
* 设置及取得上级URL
*/
function return_url($url = null)
{
if ($url) {
return \Yii::$app->user->setReturnUrl($url);
}
return host() . \Yii::$app->user->returnUrl;
}
示例4: is_dir
public function is_dir()
{
$this->_save_path = host() . 'data/' . APP_NAME . '/session';
if (!is_dir($this->_save_path)) {
is_create_dir($this->_save_path);
}
}
示例5: get_absolute_url
function get_absolute_url($relative_url)
{
if ($relative_url[0] != DIRECTORY_SEPARATOR) {
return protocol() . host() . cur_directory() . DIRECTORY_SEPARATOR . $relative_url;
} else {
return protocol() . host() . $relative_url;
}
}
示例6: load
private function load()
{
$this->_file = preg_replace_callback("/\\@load\\(\\'(.*?)\\'\\)/i", function ($matches) {
if (isset($matches[1])) {
$dir = host() . APP_NAME . '/view' . $matches[1];
$var = file_get_contents($dir);
return $var;
}
}, $this->_file);
}
示例7: plug_deploy
function plug_deploy($deploy)
{
$qb = $_SESSION['qb'];
$USE = $_SESSION['USE'];
$raed = suj_of_id($deploy);
$nl = $_GET['nl'] ? $_GET['nl'] : "nl";
if ($deploy && $USE) {
//prep
list($qauth, $subj) = sql('name,suj', 'qda', 'r', 'id="' . $deploy . '"');
$msg = sql('msg', 'qdm', 'v', 'id="' . $deploy . '"');
if ($USE == $qauth or auth(5)) {
$http = host();
if (!$_POST['dpl']) {
reqp('mail');
$qmail = mail_list_tosend();
$ret .= form("/?read={$deploy}&deploy={$deploy}&nl=nlb", txarea('dpl" maxlength="1000', $qmail, 40, 10) . br() . checkbox("dpf", "ok", "html", 1) . checkbox("multiple", "ok", "each_one", 1) . input2('submit', "send", nms(50), 'popbt'));
} else {
$htacc = urlread($deploy);
$_SESSION['nl'] = $nl;
//deploy
if ($_POST['dpf'] == "ok") {
$mail_format = "html";
$txt = format_txt($msg, $nl, $deploy);
$txt = html_entity_decode($txt);
$txt = str_replace('href="/', 'href="' . $http . '/', $txt);
$msg = lkc("", $http . $htacc, bal("h2", $subj));
$msg .= divc("panel justy", $txt);
} else {
$mail_format = "txt";
$msg = clean_internaltag($msg);
$msg = html_entity_decode($msg);
}
$_SESSION['nl'] = "";
//send
$sender = sql('mail', 'qdu', 'v', 'name="' . $USE . '"');
$lstm = str_replace("\n", ",", $_POST['dpl']);
$lstm = str_replace("\r", ",", $lstm);
$listmail = explode(",", trim($lstm));
if ($_POST['multiple'] == "ok" && is_array($listmail)) {
$sentto = send_mail_r($listmail, $mail_format, $qb . ' :: ' . $raed, $msg, $sender, $htacc);
} else {
$sentto = $_POST['dpl'];
$vm = str_replace(array(",", ";", "\n", " "), ",", $sentto);
send_mail($mail_format, $vm, $qb . ' :: ' . $raed, $msg, $sender, $htacc);
}
$ret .= lkc("popbt", '/?read=' . $deploy, 'article ' . $deploy . ' sent to: ' . $sentto);
}
} else {
$ret .= btn("popdel", "forbidden");
}
}
//if($_POST['dpl'])return $ret;
return $ret;
}
示例8: plug_rss
function plug_rss($hub, $preview)
{
if ($hub) {
$_GET['hub'] = $hub;
}
if ($preview == '=' or !$preview) {
$preview = 2;
}
if (!$hub) {
return slct_menus(ses('mn'), '/plug/rss/', '', '', '', 'kv');
}
require_once '../prog/lib.php';
req('pop,art');
require '../plug/sys.php';
require '../plug/lib.php';
$fnod = $_SESSION["qb"] . '_cache';
$main = msql_read_b('users', $fnod, '', 1);
$nb_arts = count($main);
$lastid = lastid('qda');
$last_art = $main[$lastid];
$newest = key($main);
$oldest = array_pop($main);
$nb_days = round((time() - $oldest[0]) / 86400);
$cache = 1;
$f = '../plug/_data/' . $_SESSION["qb"] . '_' . $newest . '_' . $preview . '.xml';
if (is_file($f) && !$_GET['rebuild'] && $cache) {
return read_file($f);
} else {
$http = host();
if ($preview) {
req('tri,pop,art');
}
//spe,mod
$xml .= '<' . '?xml version="1.0" encoding="iso-8859-1"?' . '>' . "\n";
$xml .= '<rss version="2.0">' . "\n";
$xml .= '<channel>' . "\n";
$xml .= bal('title', $_SESSION['qb']) . "\n";
$xml .= bal('link', $http) . "\n";
$xml .= bal('description', $nb_arts . ' articles / ' . $nb_days . ' days - preview=' . $preview . ' - static url=' . $http . substr($f, 2)) . "\n";
$xml .= bal('language', 'fr') . "\n";
$xml .= bal('lastBuildDate', date("r", $last_art[0])) . "\n";
if ($main) {
$xml .= flux_xml($main, $preview) . "\n";
}
$xml .= '</channel>' . "\n";
$xml .= '</rss>' . "\n";
write_file($f, $xml);
rss_del_old($newest);
}
//eye
eye('rss');
return $xml;
}
示例9: init
/**
* load some required files
*/
function init()
{
parent::init();
$row = $this->member_get_oauth_type($this->type);
if (!$row->id) {
exit('access deny');
}
$this->oauth_id = $row->id;
$this->app_key = $row->key1;
$this->app_secret = $row->key2;
$this->url = host() . url('oauth/' . $this->type . '/return');
}
示例10: testHost
public function testHost()
{
$this->assertEquals(host("http://example.com"), "example.com");
$this->assertEquals(host("http://EXAMPLE.COM"), "example.com");
$this->assertEquals(host("http://example.com/"), "example.com");
$this->assertEquals(host("http://example.com/ "), "example.com");
$this->assertNotEquals(host("http:// example.com/"), "example.com");
$this->assertNotEquals(host(" http://example.com/"), "example.com");
$this->assertNotEquals(host("http ://example.com/"), "example.com");
$this->assertNotEquals(host("http://example . com/"), "example.com");
$this->assertNotEquals(host("http://example. com/"), "example.com");
$this->assertNotEquals(host("http://example .com/"), "example.com");
}
示例11: __construct
function __construct($type)
{
global $con, $table;
$con = mysqli_connect(host(), username(), password(), mainDb());
switch ($type) {
case ITEM:
$table = "item";
break;
case USER:
$table = "usr";
break;
}
}
示例12: chatxinvit
function chatxinvit($p, $nm, $to)
{
$nm = ses('muse');
$to = ajxg($to);
$msg = str_replace('_NAME', $nm, helps('chatcall'));
$url = host() . '/module/chatxml/' . $p;
if ($to) {
send_mail_txt($to, $msg, $url, $nm, '');
return nms(109) . ' ' . nms(79) . 'e';
} else {
return nms(114);
}
}
示例13: init
/**
* load some required files
*/
function init()
{
parent::init();
Load::file(base_path() . 'modules/oauth/libraries/sina/SaeTOAuthV2.php');
$row = $this->member_get_oauth_type($this->type);
if (!$row->id) {
exit('access deny');
}
$this->oauth_id = $row->id;
$this->app_key = $row->key1;
$this->app_secret = $row->key2;
$this->url = host() . url('oauth/' . $this->type . '/return');
session_start();
}
示例14: as_siteurl_cookie
function as_siteurl_cookie($action)
{
global $cookie_value, $cookie_expire, $dir, $plugins_dir, $secure_url;
//
// continue only if action is 'set' and there is a cookie value,
// or if action is 'clear'
//
$continue = false;
if ($action === "set" && $cookie_value) {
$continue = true;
} elseif ($action === "clear") {
$cookie_value = " ";
$cookie_expire = 1;
$continue = true;
}
//
// redirect to cookie script - only ever called from wp-login.php
//
if ($continue) {
$path = "/" . content_dir() . "{$plugins_dir}/{$dir}/admin-ssl-cookie.php";
$file = str_replace("/wp-login.php", "", $_SERVER["SCRIPT_FILENAME"]) . $path;
as_log("as_siteurl_cookie()\nPath to admin-ssl-cookie.php: {$file}");
if (file_exists($file)) {
//
// build the URL to redirect to after setting the cookie
//
if (redirect_to() && redirect_to() !== "wp-admin/") {
if (strpos(redirect_to(), "http") === 0) {
$redirect = redirect_to();
} elseif (strpos(redirect_to(), "/") === 0) {
$redirect = scheme($use_ssl) . host() . redirect_to();
} else {
$redirect .= $secure_url . "/" . redirect_to();
}
} else {
$redirect = $secure_url . "/wp-login.php";
}
//
// build the URL to admin-ssl-cookie.php with the cookie data
//
$location = rtrim(get_option("siteurl"), "/");
$location .= "{$path}?name=" . AUTH_COOKIE . "&value={$cookie_value}";
$location .= "&expire={$cookie_expire}&path=" . COOKIEPATH . "&domain=" . COOKIE_DOMAIN;
$location .= "&redirect=" . urlencode($redirect);
as_log("as_siteurl_cookie()\nRedirecting to: {$location}");
as_redirect($location);
}
}
}
示例15: __construct
/**
* Overloads default class properties from the options.
*
* Any of the provider options can be set here, such as app_id or secret.
*
* @param array provider options
* @return void
*/
public function __construct(array $options = array())
{
if (!$this->name) {
// Attempt to guess the name from the class name
$this->name = strtolower(substr(get_class($this), strlen('OAuth2_Provider_')));
}
if (empty($options['id'])) {
throw new Exception('Required option not provided: id');
}
$this->client_id = $options['id'];
isset($options['callback']) and $this->callback = $options['callback'];
isset($options['secret']) and $this->client_secret = $options['secret'];
isset($options['scope']) and $this->scope = $options['scope'];
$this->redirect_uri = host() . \Yii::$app->request->url;
}