本文整理汇总了PHP中is_php函数的典型用法代码示例。如果您正苦于以下问题:PHP is_php函数的具体用法?PHP is_php怎么用?PHP is_php使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_php函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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');
}
开发者ID:bhavesh561988,项目名称:starter-public-edition-4,代码行数:31,代码来源:Parser_lex.php
示例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;
}
开发者ID:acamboy,项目名称:starter-public-edition-3,代码行数:34,代码来源:preg_error_message.php
示例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
}
开发者ID:NaszvadiG,项目名称:Base-CodeIgniter-App,代码行数:29,代码来源:pdo_driver.php
示例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;
}
开发者ID:anpone,项目名称:CodeIG,代码行数:37,代码来源:Common.php
示例5: __construct
public function __construct()
{
$php_required = '5.5';
if (is_php($php_required)) {
require_once APPPATH . 'third_party/guzzle/autoloader.php';
}
}
开发者ID:ci-blox,项目名称:Ignition-Go,代码行数:7,代码来源:Guzzle.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;
}
开发者ID:ExceptVL,项目名称:kanon,代码行数:27,代码来源:module.php
示例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');
}
开发者ID:wildanSawaludin,项目名称:ci-cms,代码行数:33,代码来源:admin.php
示例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");
}
开发者ID:unisexx,项目名称:adf16,代码行数:31,代码来源:Controller.php
示例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');
}
开发者ID:Qnatz,项目名称:starter-public-edition-4,代码行数:28,代码来源:Guzzle_controller.php
示例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
}
开发者ID:meelstorm,项目名称:PohFramework,代码行数:25,代码来源:pdo_driver.php
示例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 . ')');
}
开发者ID:belajarberbagi,项目名称:starter-public-edition-4,代码行数:59,代码来源:Email.php
示例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();
}
开发者ID:BPing,项目名称:PHPCbping,代码行数:62,代码来源:PHPCbping.class.php
示例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);
}
开发者ID:gamchantoi,项目名称:sisfo-ft,代码行数:13,代码来源:mysqli_driver.php
示例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');
}
开发者ID:acamboy,项目名称:starter-public-edition-3,代码行数:9,代码来源:Lex_parser_layout_test_controller.php
示例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');
}
开发者ID:patilstar,项目名称:HMVC-WITH-CI,代码行数:9,代码来源:Multiplayer_controller.php
示例16: XMLParserLib
function XMLParserLib()
{
//根据版本不同载入不同的xml解析类
if (!is_php('5.0.0')) {
require_once FCPATH . APPPATH . 'libraries/XMLParser/xmlParser4.php';
} else {
require_once FCPATH . APPPATH . 'libraries/XMLParser/xmlParser5.php';
}
}
开发者ID:zhaojianhui129,项目名称:rmp2016,代码行数:9,代码来源:XMLParserLib.php
示例17: page_2
public function page_2()
{
$this->registry->set('pjax_subnavbar_active', 'page_2');
$video = 'https://www.youtube.com/watch?v=QTXyXuqfBLA';
$php_required = '5.3.2';
if (is_php($php_required)) {
$this->load->library('multiplayer');
}
$this->template->set('video', $video)->set('php_required', $php_required)->append_title('Pjax - Test Page 2')->set_breadcrumb('Pjax', site_url('playground/pjax'))->set_breadcrumb('Pjax - Test Page 2', site_url('playground/pjax/page-2'))->build('pjax/page_2');
}
开发者ID:acamboy,项目名称:starter-public-edition-3,代码行数:10,代码来源:Pjax_controller.php
示例18: ee_array_unique
/**
* Fixes a bug in PHP 5.2.9 where sort flags defaulted
* to SORT_REGULAR, resulting in some very odd removal
* behavior. And since we have now started using it,
* we stupidly need to compat the whole thing. -pk
*/
function ee_array_unique(array $arr, $sort_flags = SORT_STRING)
{
// 5.2.9 introduced both the flags and the bug
if (is_php('5.2.9')) {
return array_unique($arr, $sort_flags);
}
// before 5.2.9 sort_string was the default
if ($sort_flags === SORT_STRING) {
return array_unique($arr);
}
// no point uniquing an array of 1 or nil
if (count($arr) < 2) {
return $arr;
}
// to be in parity with php's solution,
// we need to keep the original key positions
$key_pos = array_flip(array_keys($arr));
$ret_arr = $arr;
asort($arr, $sort_flags);
$last_kept = reset($arr);
$last_kept_k = key($arr);
next($arr);
// skip ahead
while (list($k, $v) = each($arr)) {
if ($sort_flags === SORT_NUMERIC) {
$keep = (bool) ((double) $last_kept - (double) $v);
} else {
$keep = $last_kept != $v;
}
if ($keep) {
$last_kept = $v;
$last_kept_k = $k;
} else {
// This is the mind boggling and in my opinion buggy part of
// the algorithm php uses. We unset any duplicates that follow
// the first value. Which is fine thinking narrowly about unique
// array values.
// However, it's extremely unintuitive when thinking about php
// arrays, where duplicate keys override earlier keys.
// It also makes this algorithm unstable, so that moving a boolean
// true value to different spots in the array vastly changes the
// output.
$unset = $k;
if ($key_pos[$last_kept_k] > $key_pos[$k]) {
$unset = $last_kept_k;
$last_kept = $v;
$last_kept_k = $k;
}
unset($arr[$unset]);
unset($ret_arr[$unset]);
}
}
unset($arr);
return $ret_arr;
}
开发者ID:kentonquatman,项目名称:iofa,代码行数:61,代码来源:compat_helper.php
示例19: 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;
}
$countries = $this->_get_country_data();
$countries_10 = array_slice($countries, 0, 10);
$this->template->set('br', '<br />')->set('hr', '<hr />')->set('name', 'John')->set('array_1', array('one', 'two', 'three'))->set('array_2', array('one', 'two', 'three', array('four', 'five')))->set('string_123', 'one, two, three')->set('json_123', json_encode(array('one', 'two', 'three')))->set('very_long_text', 'Very long text. Very long text. Very long text. Very long text.')->set('value_0', 0)->set('value_1', 1)->set('value_2', 2)->set('value_3', 3)->set('boolean_true', true)->set('value_null', null)->set('string_10', '10')->set('object_123', (object) array('one', 'two', 'three'))->set('dog', "I'll \"walk\" the <b>dog</b> now.")->set('dog_entities', htmlentities("I'll \"walk\" the <b>dog</b> now.", ENT_QUOTES, 'UTF-8'))->set('countries', $countries)->set('countries_10', $countries_10)->set('with_a_new_line', "a new\nline")->set('my_image', image_url('playground.jpg'))->set('string_markdown', 'Formatted **text**')->set('string_textile', 'Formatted _text_')->set('dangerous_value', 'A dangerous value <script>alert("Hi, I am dangerous.")</script>')->build('lex_parser');
}
开发者ID:bhavesh561988,项目名称:starter-public-edition-4,代码行数:11,代码来源:Lex_parser_controller.php
示例20: test_array_replace_recursive
/**
* array_replace(), array_replace_recursive() tests
*
* Borrowed from PHP's own tests
*
* @depends test_bootstrap
*/
public function test_array_replace_recursive()
{
if (is_php('5.3')) {
return $this->markTestSkipped('array_replace() and array_replace_recursive() are already available on PHP 5.3');
}
$array1 = array(0 => 'dontclobber', '1' => 'unclobbered', 'test2' => 0.0, 'test3' => array('testarray2' => TRUE, 1 => array('testsubarray1' => 'dontclobber2', 'testsubarray2' => 'dontclobber3')));
$array2 = array(1 => 'clobbered', 'test3' => array('testarray2' => FALSE), 'test4' => array('clobbered3' => array(0, 1, 2)));
// array_replace()
$this->assertEquals(array(0 => 'dontclobber', 1 => 'clobbered', 'test2' => 0.0, 'test3' => array('testarray2' => FALSE), 'test4' => array('clobbered3' => array(0, 1, 2))), array_replace($array1, $array2));
// array_replace_recursive()
$this->assertEquals(array(0 => 'dontclobber', 1 => 'clobbered', 'test2' => 0.0, 'test3' => array('testarray2' => FALSE, 1 => array('testsubarray1' => 'dontclobber2', 'testsubarray2' => 'dontclobber3')), 'test4' => array('clobbered3' => array(0, 1, 2))), array_replace_recursive($array1, $array2));
}
开发者ID:texasag99,项目名称:pricebook,代码行数:19,代码来源:array_test.php
注:本文中的is_php函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论