本文整理汇总了PHP中r::cli方法的典型用法代码示例。如果您正苦于以下问题:PHP r::cli方法的具体用法?PHP r::cli怎么用?PHP r::cli使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类r
的用法示例。
在下文中一共展示了r::cli方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
if (isset($this->index)) {
return $this->index;
}
if (r::cli()) {
return $this->index = '/';
} else {
return $this->index = url::base() . preg_replace('!\\/index\\.php$!i', '', server::get('SCRIPT_NAME'));
}
}
示例2: index
public function index()
{
if (isset($this->index)) {
return $this->index;
}
// this value is used by the Panel
$this->indexDetected = true;
if (r::cli()) {
return $this->index = '/';
} else {
return $this->index = url::base() . preg_replace('!\\/index\\.php$!i', '', server::get('SCRIPT_NAME'));
}
}
示例3: index
public function index()
{
if (isset($this->index)) {
return $this->index;
}
if (r::cli()) {
$index = '/';
} else {
$index = url::base() . preg_replace('!\\/index\\.php$!i', '', server::get('SCRIPT_NAME'));
}
// fix index URL for the Panel
if (function_exists('panel')) {
$index = dirname($index);
}
return $this->index = $index;
}
示例4: dump
/**
* Dumps any array or object in a human readable way
*
* @param mixed $variable Whatever you like to inspect
* @param boolean $echo
* @return string
*/
function dump($variable, $echo = true)
{
if (r::cli()) {
$output = print_r($variable, true) . PHP_EOL;
} else {
$output = '<pre>' . print_r($variable, true) . '</pre>';
}
if ($echo == true) {
echo $output;
}
return $output;
}
示例5: index
/**
* Returns the URL for document root no
* matter what the path is.
*
* @return string
*/
public static function index()
{
if (r::cli()) {
return '/';
} else {
return static::base() . preg_replace('!\\/index\\.php$!i', '', server::get('SCRIPT_NAME'));
}
}
示例6: fingerprint
/**
* Generates a fingerprint from the user agent string
*
* @return string
*/
public static function fingerprint()
{
if (!r::cli()) {
return sha1($_SERVER['HTTP_USER_AGENT'] . (ip2long($_SERVER['REMOTE_ADDR']) & ip2long('255.255.0.0')));
} else {
return '';
}
}
示例7: fingerprint
/**
* Generates a fingerprint from the user agent string
*
* @return string
*/
public static function fingerprint()
{
if (!r::cli()) {
return sha1(Visitor::ua() . (ip2long($_SERVER['REMOTE_ADDR']) & ip2long('255.255.0.0')));
} else {
return '';
}
}
示例8: url
/**
* Returns the proper base url for the installation
*
* @return string
*/
protected static function url()
{
// auto-detect the url
if (empty(c::$data['url'])) {
if (r::cli()) {
return c::$data['url'] = '/';
} else {
return c::$data['url'] = url::scheme() . '://' . server::get('HTTP_HOST') . preg_replace('!\\/index\\.php$!i', '', server::get('SCRIPT_NAME'));
}
} else {
return c::$data['url'];
}
}
示例9: testCli
public function testCli()
{
$this->assertTrue(r::cli());
}