本文整理汇总了PHP中is_php函数的典型用法代码示例。如果您正苦于以下问题:PHP is_php函数的具体用法?PHP is_php怎么用?PHP is_php使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_php函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
public function initialize()
{
$php_min = '5.3';
if (!is_php($php_min)) {
throw new Exception('CI_Parser_lex: Requires PHP ' . $php_min . ' or above.');
}
$this->ci = get_instance();
// Default configuration options.
$this->config = array('cumulative_noparse' => false, 'scope_glue' => '.', 'allow_php' => false, 'full_path' => false);
if ($this->ci->config->load('parser_lex', TRUE, TRUE)) {
$defaults = $this->ci->config->item('parser_lex');
if (array_key_exists('allowed_functions', $defaults)) {
unset($defaults['allowed_functions']);
}
if (array_key_exists('allowed_globals', $defaults)) {
unset($defaults['allowed_globals']);
}
if (array_key_exists('disabled_config_settings', $defaults)) {
unset($defaults['disabled_config_settings']);
}
$this->config = array_merge($this->config, $defaults);
}
// Injecting configuration options directly.
if (isset($this->_parent) && !empty($this->_parent->params) && is_array($this->_parent->params)) {
$this->config = array_merge($this->config, $this->_parent->params);
if (array_key_exists('parser_driver', $this->config)) {
unset($this->config['parser_driver']);
}
}
log_message('info', 'CI_Parser_lex Class Initialized');
}
示例2: preg_error_message
function preg_error_message($code = null)
{
if ($code === null) {
$code = preg_last_error();
}
$code = (int) $code;
switch ($code) {
case PREG_NO_ERROR:
$result = 'PCRE: No error, probably invalid regular expression.';
break;
case PREG_INTERNAL_ERROR:
$result = 'PCRE: Internal error.';
break;
case PREG_BACKTRACK_LIMIT_ERROR:
$result = 'PCRE: Backtrack limit has been exhausted.';
break;
case PREG_RECURSION_LIMIT_ERROR:
$result = 'PCRE: Recursion limit has been exhausted.';
break;
case PREG_BAD_UTF8_ERROR:
$result = 'PCRE: Malformed UTF-8 data.';
break;
default:
if (is_php('5.3') && $code == PREG_BAD_UTF8_OFFSET_ERROR) {
$result = 'PCRE: Did not end at a valid UTF-8 codepoint.';
} elseif (is_php('7') && $code == PREG_JIT_STACKLIMIT_ERROR) {
$result = 'PCRE: Failed because of limited JIT stack space.';
} else {
$result = 'PCRE: Error ' . $code . '.';
}
break;
}
return $result;
}
示例3: __construct
function __construct($params)
{
parent::__construct($params);
// clause and character used for LIKE escape sequences
if (strpos($this->hostname, 'mysql') !== FALSE) {
$this->_like_escape_str = '';
$this->_like_escape_chr = '';
//Prior to this version, the charset can't be set in the dsn
if (is_php('5.3.6')) {
$this->hostname .= ";charset={$this->char_set}";
}
//Set the charset with the connection options
$this->options['PDO::MYSQL_ATTR_INIT_COMMAND'] = "SET NAMES {$this->char_set}";
} elseif (strpos($this->hostname, 'odbc') !== FALSE) {
$this->_like_escape_str = " {escape '%s'} ";
$this->_like_escape_chr = '!';
} else {
$this->_like_escape_str = " ESCAPE '%s' ";
$this->_like_escape_chr = '!';
}
/**
* @link http://stackoverflow.com/questions/11054618/codeigniter-pdo-database-driver-not-working
*/
// empty($this->database) OR $this->hostname .= ';dbname='.$this->database;
$this->hostname = 'mysql:dbname=' . $this->database . ';host=' . $this->hostname;
$this->trans_enabled = FALSE;
$this->_random_keyword = ' RND(' . time() . ')';
// database specific random keyword
}
示例4: is_really_writable
/**
* Tests for file writability 测试文件可写性
*
* is_writable() returns TRUE on Windows servers when you really can't write to
* the file, based on the read-only attribute. is_writable() is also unreliable
* on Unix servers if safe_mode is on.
*is_writable()返回TRUE在Windows服务器上,当你真的不能写入文件,根据只读属性。is_writable()也在Unix服务器如果safe_mode是不可靠的。
*
* @link https://bugs.php.net/bug.php?id=54709
* @param string
* @return bool
*/
function is_really_writable($file)
{
// If we're on a Unix server with safe_mode off we call is_writable 如果我们在Unix服务器safe_mode我们称之为is_writable
if (DIRECTORY_SEPARATOR === '/' && (is_php('5.4') or !ini_get('safe_mode'))) {
return is_writable($file);
}
/* For Windows servers and safe_mode "on" installations we'll actually
* write a file then read it. Bah...
* Windows服务器和safe_mode”在“安装我们会写一个文件然后读它。呸……
*/
if (is_dir($file)) {
$file = rtrim($file, '/') . '/' . md5(mt_rand());
if (($fp = @fopen($file, 'ab')) === FALSE) {
return FALSE;
}
fclose($fp);
@chmod($file, 0777);
@unlink($file);
return TRUE;
} elseif (!is_file($file) or ($fp = @fopen($file, 'ab')) === FALSE) {
return FALSE;
}
fclose($fp);
return TRUE;
}
示例5: __construct
public function __construct()
{
$php_required = '5.5';
if (is_php($php_required)) {
require_once APPPATH . 'third_party/guzzle/autoloader.php';
}
}
示例6: _load
protected function _load()
{
if ($this->_isLoaded) {
return;
}
static $types = array('model', 'modelProperty', 'controller', 'controlSet', 'control');
$modulePath = kanon::getBasePath() . '/modules/' . $this->_name;
if (is_file($modulePath . '/module.php') && is_php($modulePath . '/module.php')) {
include $modulePath . '/module.php';
$this->_autoload = $autoload;
foreach ($this->_autoload as $class => $filename) {
$classFilename = $modulePath . '/' . $filename;
if (is_file($classFilename) && is_php($classFilename)) {
require_once $classFilename;
$type = '';
$r = new ReflectionClass($class);
foreach ($types as $checkType) {
if ($r->isSubclassOf($checkType)) {
$type = $checkType;
}
}
$this->_classes[$type][$class] = $filename;
}
}
}
$this->_isLoaded = true;
}
示例7: index
function index()
{
if (!isset($this->user->level) || $this->user->level['admin'] == 0) {
redirect('admin/unauthorized/admin/1');
}
if ($this->user->email == '') {
$this->session->set_flashdata('notification', __("Please set your email", $this->template['module']));
redirect('admin/member/edit');
}
// Get News
// Get News if Php version smaller than 5.3.0
$news = array();
$news2 = array();
if (!is_php('5.3.0')) {
$this->load->library('Simplepie');
$this->simplepie->set_feed_url('http://ci-cms.blogspot.com/feeds/posts/default/-/news');
$this->simplepie->set_cache_location('./cache');
$this->simplepie->init();
$this->simplepie->handle_content_type();
$news = $this->simplepie->get_items();
// Get Development News
$this->simplepie2 = new SimplePie();
$this->simplepie2->set_feed_url('http://bitbucket.org/hery/ci-cms/rss?token=ffaaafc0111cc8100198a44b5c263671');
$this->simplepie2->set_cache_location('./cache');
$this->simplepie2->init();
$this->simplepie2->handle_content_type();
$news2 = $this->simplepie2->get_items();
}
// Save news if avaliable
$this->template['cicms_news'] = $news;
$this->template['cicms2_news'] = $news2;
$this->layout->load($this->template, 'index');
}
示例8: Controller
/**
* Constructor
*
* Calls the initialize() function
*/
function Controller()
{
parent::CI_Base();
// Assign all the class objects that were instantiated by the
// bootstrap file (CodeIgniter.php) to local class variables
// so that CI can run as one big super object.
foreach (is_loaded() as $var => $class) {
$this->{$var} =& load_class($class);
}
// In PHP 5 the Loader class is run as a discreet
// class. In PHP 4 it extends the Controller @PHP4
if (is_php('5.0.0') == TRUE) {
$this->load =& load_class('Loader', 'core');
$this->load->_base_classes =& is_loaded();
$this->load->_ci_autoloader();
} else {
$this->_ci_autoloader();
// sync up the objects since PHP4 was working from a copy
foreach (array_keys(get_object_vars($this)) as $attribute) {
if (is_object($this->{$attribute})) {
$this->load->{$attribute} =& $this->{$attribute};
}
}
}
log_message('debug', "Controller Class Initialized");
}
示例9: index
public function index()
{
$php_required = '5.5';
$this->load->helper('url');
$result = null;
$status_code = null;
$content_type = null;
$code_example = <<<EOT
\$user_id = 1;
\$this->load->helper('url');
\$client = new GuzzleHttp\\Client();
\$res = \$client->get(site_url('playground/rest/server-api-example/users/id/'.\$user_id.'/format/json'), ['auth' => ['admin', '1234']]);
\$result = (string) \$res->getBody();
\$status_code = \$res->getStatusCode();
\$content_type = \$res->getHeader('content-type');
\$content_type = is_array(\$content_type) ? \$content_type[0] : \$content_type;
EOT;
if (is_php($php_required)) {
eval($code_example);
}
$this->template->set(compact('php_required', 'code_example', 'result', 'status_code', 'content_type'))->build('rest/guzzle');
}
示例10: __construct
function __construct($params)
{
parent::__construct($params);
// clause and character used for LIKE escape sequences
if (strpos($this->hostname, 'mysql') !== FALSE) {
$this->_like_escape_str = '';
$this->_like_escape_chr = '';
//Prior to this version, the charset can't be set in the dsn
if (is_php('5.3.6')) {
$this->hostname .= ";charset={$this->char_set}";
}
//Set the charset with the connection options
$this->options['PDO::MYSQL_ATTR_INIT_COMMAND'] = "SET NAMES {$this->char_set}";
} elseif (strpos($this->hostname, 'odbc') !== FALSE) {
$this->_like_escape_str = " {escape '%s'} ";
$this->_like_escape_chr = '!';
} else {
$this->_like_escape_str = " ESCAPE '%s' ";
$this->_like_escape_chr = '!';
}
empty($this->database) or $this->hostname .= ';dbname=' . $this->database;
$this->trans_enabled = FALSE;
$this->_random_keyword = ' RND(' . time() . ')';
// database specific random keyword
}
示例11: __construct
public function __construct($config = array())
{
$this->_is_ci_3 = (bool) ((int) CI_VERSION >= 3);
$this->CI = get_instance();
$this->CI->load->helper('email');
$this->CI->load->helper('html');
if (!is_array($config)) {
$config = array();
}
if (isset($config['useragent'])) {
$useragent = trim($config['useragent']);
$mailer_engine = strtolower($useragent);
if (strpos($mailer_engine, 'phpmailer') !== false) {
$this->mailer_engine = 'phpmailer';
} elseif (strpos($mailer_engine, 'codeigniter') !== false) {
$this->mailer_engine = 'codeigniter';
} else {
unset($config['useragent']);
// An invalid setting;
}
}
if (isset($config['charset'])) {
$charset = trim($config['charset']);
if ($charset != '') {
$this->charset = $charset;
unset($config['charset']);
// We don't need this anymore.
}
} else {
$charset = trim(config_item('charset'));
if ($charset != '') {
$this->charset = $charset;
}
}
$this->charset = strtoupper($this->charset);
if ($this->mailer_engine == 'phpmailer') {
//// If your system uses class autoloading feature,
//// then the following require statement would not be needed.
//if (!class_exists('PHPMailer', false)) {
// require_once COMMONPATH.'third_party/phpmailer/PHPMailerAutoload.php';
//}
////
$this->phpmailer = new PHPMailer();
$this->phpmailer->PluginDir = COMMONPATH . 'third_party/phpmailer/';
// Added by Ivan Tcholakov, 16-FEB-2015.
$this->phpmailer->setLanguage($this->CI->lang->custom_code('phpmailer'));
$this->_copy_property_to_phpmailer('charset');
}
if (count($config) > 0) {
$this->initialize($config);
} else {
$this->_smtp_auth = ($this->smtp_user == '' and $this->smtp_pass == '') ? FALSE : TRUE;
if ($this->mailer_engine == 'phpmailer') {
$this->_copy_property_to_phpmailer('_smtp_auth');
}
}
$this->_safe_mode = !is_php('5.4') && ini_get('safe_mode');
log_message('info', 'Email Class Initialized (Engine: ' . $this->mailer_engine . ')');
}
示例12: start
/**
* 启动
*/
public static function start()
{
/*
* ------------------------------------------------------
* 设置时区
* ------------------------------------------------------
*/
date_default_timezone_set("Asia/Shanghai");
/*
* ------------------------------------------------------
* 安全程序:关掉魔法引号,过滤全局变量
* ------------------------------------------------------
*/
if (!is_php('5.4')) {
ini_set('magic_quotes_runtime', 0);
if ((bool) ini_get('register_globals')) {
$_protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST', '_SESSION', '_ENV', '_COOKIE', 'GLOBALS', 'HTTP_RAW_POST_DATA', '_protected', '_registered');
$_registered = ini_get('variables_order');
foreach (array('E' => '_ENV', 'G' => '_GET', 'P' => '_POST', 'C' => '_COOKIE', 'S' => '_SERVER') as $key => $superglobal) {
if (strpos($_registered, $key) === FALSE) {
continue;
}
foreach (array_keys(${$superglobal}) as $var) {
if (isset($GLOBALS[$var]) && !in_array($var, $_protected, TRUE)) {
$GLOBALS[$var] = NULL;
}
}
}
}
}
/*
* ------------------------------------------------------
* 异常处理,错误处理等,记录错误日志
* ------------------------------------------------------
*/
register_shutdown_function("_finish_handle");
set_exception_handler("_exception_handle");
set_error_handler("_error_handle");
/*
* ------------------------------------------------------
* 注册自动加载方法
* ------------------------------------------------------
*/
spl_autoload_register("Loader::autoload");
Loader::setClassDir((array) AppHelper::Instance()->config("APP_AUTOLOAD_PATH"));
Loader::setSuffix((array) AppHelper::Instance()->config("CLASS_FILE_SUFFIX"));
/*
* ------------------------------------------------------
* ini 设置
* ------------------------------------------------------
*/
//默认字符编码为UTF-8
ini_set('default_charset', 'UTF-8');
//日志初始
log_message(LOG_INFO, "初始处理完毕", \Utils\UtilFactory::getLogHandle());
//运行核心程序
log_message(LOG_INFO, "运行核心程序................");
CommandHandler::run();
}
示例13: db_pconnect
/**
* Persistent database connection
*
* @return object
*/
public function db_pconnect()
{
// Persistent connection support was added in PHP 5.3.0
if (!is_php('5.3')) {
return $this->db_connect();
}
return $this->port != '' ? @mysqli_connect('p:' . $this->hostname, $this->username, $this->password, $this->database, $this->port) : @mysqli_connect('p:' . $this->hostname, $this->username, $this->password, $this->database);
}
示例14: index
public function index()
{
$php_min = '5.3';
if (!is_php($php_min)) {
$this->output->set_output('PHP ' . $php_min . ' is required for Lex parser.');
return;
}
$this->template->build('lex_parser_layout_test');
}
示例15: index
public function index()
{
$videos = array('https://www.youtube.com/watch?v=NRhVcTTMlrM', 'http://vimeo.com/60743823', 'http://www.dailymotion.com/video/x9kdze', 'http://vbox7.com/play:25c4115f2d');
$system_requirements_ok = is_php('5.3.2');
if ($system_requirements_ok) {
$this->load->library('multiplayer');
}
$this->template->set('videos', $videos)->set('system_requirements_ok', $system_requirements_ok)->build('multiplayer');
}