当前位置: 首页>>代码示例>>PHP>>正文


PHP phpversion函数代码示例

本文整理汇总了PHP中phpversion函数的典型用法代码示例。如果您正苦于以下问题:PHP phpversion函数的具体用法?PHP phpversion怎么用?PHP phpversion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了phpversion函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_class_constructor

function get_class_constructor($classname)
{
    // Caching
    static $constructors = array();
    if (!class_exists($classname)) {
        return false;
    }
    // Tests indicate this doesn't hurt even in PHP5.
    $classname = strtolower($classname);
    // Return cached value, if exists
    if (isset($constructors[$classname])) {
        return $constructors[$classname];
    }
    // Get a list of methods. After examining several different ways of
    // doing the check, (is_callable, method_exists, function_exists etc)
    // it seems that this is the most reliable one.
    $methods = get_class_methods($classname);
    // PHP5 constructor?
    if (phpversion() >= '5') {
        if (in_array('__construct', $methods)) {
            return $constructors[$classname] = '__construct';
        }
    }
    // If we have PHP5 but no magic constructor, we have to lowercase the methods
    $methods = array_map('strtolower', $methods);
    if (in_array($classname, $methods)) {
        return $constructors[$classname] = $classname;
    }
    return $constructors[$classname] = NULL;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:30,代码来源:blocklib.php

示例2: getEnvironment

 protected function getEnvironment()
 {
     if (version_compare(phpversion(), '5.3.0', '>=')) {
         return include 'PHP53/TestInclude.php';
     }
     return parent::getEnvironment();
 }
开发者ID:tatu-carreta,项目名称:mariasanti_v2,代码行数:7,代码来源:TestTest.php

示例3: generateRequestSign

 /**
  * Generates the fingerprint for request.
  *
  * @param string $merchantApiLoginId
  * @param string $merchantTransactionKey
  * @param string $amount
  * @param string $fpSequence An invoice number or random number.
  * @param string $fpTimestamp
  * @return string The fingerprint.
  */
 public function generateRequestSign($merchantApiLoginId, $merchantTransactionKey, $amount, $currencyCode, $fpSequence, $fpTimestamp)
 {
     if (phpversion() >= '5.1.2') {
         return hash_hmac("md5", $merchantApiLoginId . "^" . $fpSequence . "^" . $fpTimestamp . "^" . $amount . "^" . $currencyCode, $merchantTransactionKey);
     }
     return bin2hex(mhash(MHASH_MD5, $merchantApiLoginId . "^" . $fpSequence . "^" . $fpTimestamp . "^" . $amount . "^" . $currencyCode, $merchantTransactionKey));
 }
开发者ID:blazeriaz,项目名称:youguess,代码行数:17,代码来源:Request.php

示例4: __construct

 public function __construct($config, $transFunc, $transFuncArgs = array())
 {
     $this->config = array('x2_version' => '', 'php_version' => phpversion(), 'GD_support' => function_exists('gd_info') ? 1 : 0, 'db_type' => 'MySQL', 'db_version' => '', 'unique_id' => 'none', 'formId' => '', 'submitButtonId' => '', 'statusId' => '', 'themeUrl' => '', 'titleWrap' => array('<h2>', '</h2>'), 'receiveUpdates' => 1, 'serverInfo' => False, 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'registered' => 0, 'edition' => 'opensource', 'isUpgrade' => False);
     foreach ($config as $key => $value) {
         $this->config[$key] = $value;
     }
     // Is it OS edition?
     $this->os = $config['edition'] == 'opensource' && !$this->config['isUpgrade'];
     // Empty the unique_id field; user will fill it.
     if (!$this->os) {
         if ($this->config['unique_id'] == 'none') {
             $this->config['unique_id'] = '';
         }
     }
     // $this->config['unique_id'] = 'something'; // To test what the form looks like when unique_id is filled
     // Translate all messages for the updates form:
     foreach (array('label', 'message', 'leadSources') as $attr) {
         $attrArr = $this->{$attr};
         foreach (array_keys($this->{$attr}) as $key) {
             $attrArr[$key] = call_user_func_array($transFunc, array_merge($transFuncArgs, array($attrArr[$key])));
         }
         $this->{$attr} = $attrArr;
     }
     $this->message['connectionNOsMessage'] .= ': <a href="http://www.x2crm.com/contact/">x2crm.com</a>.';
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:25,代码来源:UpdatesForm.php

示例5: check

 public function check()
 {
     if (phpversion() < '5.0.0') {
         return Response::json(FAIL, array('您的php版本过低,不能安装本软件,请升级到5.0.0或更高版本再安装,谢谢!'));
     }
     if (!extension_loaded('PDO')) {
         return Response::json(FAIL, array('请加载PHP的PDO模块,谢谢!'));
     }
     if (!function_exists('session_start')) {
         return Response::json(FAIL, array('请开启session,谢谢!'));
     }
     if (!is_writable(ROOT_PATH)) {
         return Response::json(FAIL, array('请保证代码目录有写权限,谢谢!'));
     }
     $config = (require CONFIG_PATH . 'mysql.php');
     try {
         $mysql = new PDO('mysql:host=' . $config['master']['host'] . ';port=' . $config['master']['port'], $config['master']['user'], $config['master']['pwd']);
     } catch (Exception $e) {
         return Response::json(FAIL, array('请正确输入信息连接mysql,保证启动mysql,谢谢!'));
     }
     $mysql->exec('CREATE DATABASE ' . $config['master']['dbname']);
     $mysql = null;
     unset($config);
     return Response::json(SUCC, array('检测通过'));
 }
开发者ID:swg0110,项目名称:iBarn,代码行数:25,代码来源:Install.class.php

示例6: getparam

function getparam($name)
{
    $param = '';
    $curver = (int) str_replace('.', '', phpversion());
    if ($curver >= 410) {
        // superglobals available from ver. 4.1.0
        if (@$_POST["{$name}"]) {
            // POST before GET
            $param = $_POST["{$name}"];
        } elseif (@$_GET["{$name}"]) {
            $param = $_GET["{$name}"];
        }
    } else {
        // superglobals aren't available
        global $HTTP_POST_VARS, $HTTP_GET_VARS;
        if (@$HTTP_POST_VARS["{$name}"]) {
            $param = $HTTP_POST_VARS["{$name}"];
        } elseif (@$HTTP_GET_VARS["{$name}"]) {
            $param = $HTTP_GET_VARS["{$name}"];
        }
    }
    if (is_array($param)) {
        foreach ($param as $element) {
            $element = addslashes($element);
        }
    } else {
        $param = addslashes($param);
    }
    return $param;
}
开发者ID:bitweaver,项目名称:bitcart,代码行数:30,代码来源:functions.php

示例7: __construct

 /**
  * Construct the Google Client.
  *
  * @param $config Google_Config or string for the ini file to load
  */
 public function __construct($config = null)
 {
     if (is_string($config) && strlen($config)) {
         $config = new Google_Config($config);
     } else {
         if (!$config instanceof Google_Config) {
             $config = new Google_Config();
             if ($this->isAppEngine()) {
                 // Automatically use Memcache if we're in AppEngine.
                 $config->setCacheClass('Google_Cache_Memcache');
             }
             if (version_compare(phpversion(), "5.3.4", "<=") || $this->isAppEngine()) {
                 // Automatically disable compress.zlib, as currently unsupported.
                 $config->setClassConfig('Google_Http_Request', 'disable_gzip', true);
             }
         }
     }
     if ($config->getIoClass() == Google_Config::USE_AUTO_IO_SELECTION) {
         if (function_exists('curl_version') && function_exists('curl_exec') && !$this->isAppEngine()) {
             $config->setIoClass("Google_IO_Curl");
         } else {
             $config->setIoClass("Google_IO_Stream");
         }
     }
     $this->config = $config;
 }
开发者ID:hzhou9,项目名称:coupon_deal,代码行数:31,代码来源:Client.php

示例8: __construct

 /**
  *  Create new Openstack Object
  */
 function __construct($custom_settings = null, $oc_version = null)
 {
     // Set opencloud version to use
     $this->opencloud_version = version_compare(phpversion(), '5.3.3') >= 0 ? '1.10.0' : '1.5.10';
     $this->opencloud_version = !is_null($oc_version) ? $oc_version : $this->opencloud_version;
     // Get settings, if they exist
     (object) ($custom_settings = !is_null($custom_settings) ? $custom_settings : get_option(RS_CDN_OPTIONS));
     // Set settings
     $settings = new stdClass();
     $settings->username = isset($custom_settings->username) ? $custom_settings->username : 'Username';
     $settings->apiKey = isset($custom_settings->apiKey) ? $custom_settings->apiKey : 'API Key';
     $settings->use_ssl = isset($custom_settings->use_ssl) ? $custom_settings->use_ssl : false;
     $settings->container = isset($custom_settings->container) ? $custom_settings->container : 'default';
     $settings->cdn_url = null;
     $settings->files_to_ignore = null;
     $settings->remove_local_files = isset($custom_settings->remove_local_files) ? $custom_settings->remove_local_files : false;
     $settings->verified = false;
     $settings->custom_cname = null;
     $settings->region = isset($custom_settings->region) ? $custom_settings->region : 'ORD';
     $settings->url = isset($custom_settings->url) ? $custom_settings->url : 'https://identity.api.rackspacecloud.com/v2.0/';
     // Set API settings
     $this->api_settings = (object) $settings;
     // Return client OR set settings
     if ($this->opencloud_version == '1.10.0') {
         // Set Rackspace CDN settings
         $this->oc_client = $this->opencloud_client();
         $this->oc_service = $this->oc_client->objectStoreService('cloudFiles', $settings->region);
     }
     // Set container object
     $this->oc_container = $this->container_object();
 }
开发者ID:svn2github,项目名称:rackspace-cloud-files-cdn,代码行数:34,代码来源:class.rs_cdn.php

示例9: main

 /**
  * Automatically generate a variety of files
  *
  */
 function main()
 {
     if (!empty($this->digestPath) && file_exists($this->digestPath) && $this->hasExpectedFiles()) {
         if ($this->getDigest() === file_get_contents($this->digestPath)) {
             echo "GenCode has previously executed. To force execution, please (a) omit CIVICRM_GENCODE_DIGEST\n";
             echo "or (b) remove {$this->digestPath} or (c) call GenCode with new parameters.\n";
             exit;
         }
         // Once we start GenCode, the old build is invalid
         unlink($this->digestPath);
     }
     echo "\ncivicrm_domain.version := " . $this->db_version . "\n\n";
     if ($this->buildVersion < 1.1) {
         echo "The Database is not compatible for this version";
         exit;
     }
     if (substr(phpversion(), 0, 1) != 5) {
         echo phpversion() . ', ' . substr(phpversion(), 0, 1) . "\n";
         echo "\nCiviCRM requires a PHP Version >= 5\nPlease upgrade your php / webserver configuration\nAlternatively you can get a version of CiviCRM that matches your PHP version\n";
         exit;
     }
     $specification = new CRM_Core_CodeGen_Specification();
     $specification->parse($this->schemaPath, $this->buildVersion);
     # cheese:
     $this->database = $specification->database;
     $this->tables = $specification->tables;
     $this->runAllTasks();
     if (!empty($this->digestPath)) {
         file_put_contents($this->digestPath, $this->getDigest());
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:35,代码来源:Main.php

示例10: isGeVersion

 /**
  * @brief 服务器的php版本比对
  * @param string 要比对的php版本号 例如:5.1.0
  * @return bool 值: true:达到版本标准; false:未达到版本标准;
  */
 public static function isGeVersion($version)
 {
     //获取当前php版本号
     $locVersion = phpversion();
     $result = version_compare($locVersion, $version);
     return $result >= 0 ? true : false;
 }
开发者ID:chenyongze,项目名称:iwebshop,代码行数:12,代码来源:server_class.php

示例11: getPrettyString

 /**
  * A human readable textual representation of the problem's reasons
  *
  * @param array $installedMap A map of all installed packages
  */
 public function getPrettyString(array $installedMap = array())
 {
     $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
     if (count($reasons) === 1) {
         reset($reasons);
         $reason = current($reasons);
         $rule = $reason['rule'];
         $job = $reason['job'];
         if ($job && $job['cmd'] === 'install' && empty($job['packages'])) {
             // handle php extensions
             if (0 === stripos($job['packageName'], 'ext-')) {
                 $ext = substr($job['packageName'], 4);
                 $error = extension_loaded($ext) ? 'has the wrong version (' . phpversion($ext) . ') installed' : 'is missing from your system';
                 return 'The requested PHP extension ' . $job['packageName'] . $this->constraintToText($job['constraint']) . ' ' . $error . '.';
             }
             return 'The requested package ' . $job['packageName'] . $this->constraintToText($job['constraint']) . ' could not be found.';
         }
     }
     $messages = array();
     foreach ($reasons as $reason) {
         $rule = $reason['rule'];
         $job = $reason['job'];
         if ($job) {
             $messages[] = $this->jobToText($job);
         } elseif ($rule) {
             if ($rule instanceof Rule) {
                 $messages[] = $rule->getPrettyString($installedMap);
             }
         }
     }
     return "\n    - " . implode("\n    - ", $messages);
 }
开发者ID:rodchyn,项目名称:composer,代码行数:37,代码来源:Problem.php

示例12: run_self_tests

function run_self_tests()
{
    global $MYSITE;
    global $LAST_UPDATED, $sqlite, $mirror_stats, $md5_ok;
    //$MYSITE = "http://sg.php.net/";
    $content = fetch_contents($MYSITE . "manual/noalias.txt");
    if (is_array($content) || trim($content) !== 'manual-noalias') {
        return array("name" => "Apache manual alias", "see" => $MYSITE . "mirroring-troubles.php#manual-redirect", "got" => $content);
    }
    $ctype = fetch_header($MYSITE . "manual/en/faq.html.php", "content-type");
    if (strpos($ctype, "text/html") === false) {
        return array("name" => "Header weirdness. Pages named '.html.php' are returning wrong status headers", "see" => $MYSITE . "mirroring-troubles.php#content-type", "got" => var_export($ctype, true));
    }
    $ctype = fetch_header($MYSITE . "functions", "content-type");
    if (is_array($ctype)) {
        $ctype = current($ctype);
    }
    if (strpos($ctype, "text/html") === false) {
        return array("name" => "MultiViews on", "see" => $MYSITE . "mirroring-troubles.php#multiviews", "got" => var_export($ctype, true));
    }
    $header = fetch_header($MYSITE . "manual/en/ref.var.php", 0);
    list($ver, $status, $msg) = explode(" ", $header, 3);
    if ($status != 200) {
        return array("name" => "Var Handler", "see" => $MYSITE . "mirroring-troubles.php#var", "got" => var_export($header, true));
    }
    return array("servername" => $MYSITE, "version" => phpversion(), "updated" => $LAST_UPDATED, "sqlite" => $sqlite, "stats" => $mirror_stats, "language" => default_language(), "rsync" => $md5_ok);
}
开发者ID:romainneutron,项目名称:web-php,代码行数:27,代码来源:mirror-info.php

示例13: set

 function set($properties, $desc = '')
 {
     if (!isset($properties)) {
         return;
     }
     if (is_array($properties)) {
         foreach ($properties as $k => $v) {
             $key = strtolower($k);
             if (floatval(phpversion()) > 5.3) {
                 if (property_exists($this, $key)) {
                     $this->{$key} = $v;
                 }
             } else {
                 if (array_key_exists($key, $this)) {
                     $this->{$key} = $v;
                 }
             }
         }
     } else {
         $this->value = $properties;
         if (!empty($desc)) {
             $this->desc = $desc;
         }
     }
 }
开发者ID:mover5,项目名称:imobackup,代码行数:25,代码来源:EzOptions.php

示例14: __construct

 /**
  * Compropago Client Constructor
  * @param array $params
  * @throws Exception
  */
 public function __construct($params = array())
 {
     if (!array_key_exists('publickey', $params) || !array_key_exists('privatekey', $params) || empty($params['publickey']) || empty($params['privatekey'])) {
         $error = "Se requieren las llaves del API de Compropago";
         throw new Exception($error);
     } else {
         $this->auth = [$params['privatekey'], $params['publickey']];
         ///////////cambiar a formato curl?
         //Modo Activo o Pruebas
         if ($params['live'] == false) {
             $this->deployUri = self::API_SANDBOX_URI;
             $this->deployMode = true;
         } else {
             $this->deployUri = self::API_LIVE_URI;
             $this->deployMode = false;
         }
         if (isset($params['contained']) && !empty($params['contained'])) {
             $extra = $params['contained'];
         } else {
             $extra = 'SDK; PHP ' . phpversion() . ';';
         }
         $http = new Request($this->deployUri);
         $http->setUserAgent(self::USER_AGENT_SUFFIX, $this->getVersion(), $extra);
         $http->setAuth($this->auth);
         $this->http = $http;
     }
 }
开发者ID:ralts00,项目名称:compropago-php,代码行数:32,代码来源:Client.php

示例15: ensureRequiredEnvironment

 /**
  * Checks PHP version and other parameters of the environment
  *
  * @return mixed
  */
 protected function ensureRequiredEnvironment()
 {
     if (version_compare(phpversion(), \Neos\Flow\Core\Bootstrap::MINIMUM_PHP_VERSION, '<')) {
         return new Error('Flow requires PHP version %s or higher but your installed version is currently %s.', 1172215790, [\Neos\Flow\Core\Bootstrap::MINIMUM_PHP_VERSION, phpversion()]);
     }
     if (!extension_loaded('mbstring')) {
         return new Error('Flow requires the PHP extension "mbstring" to be available', 1207148809);
     }
     if (DIRECTORY_SEPARATOR !== '/' && PHP_WINDOWS_VERSION_MAJOR < 6) {
         return new Error('Flow does not support Windows versions older than Windows Vista or Windows Server 2008, because they lack proper support for symbolic links.', 1312463704);
     }
     foreach ($this->requiredExtensions as $extension => $errorKey) {
         if (!extension_loaded($extension)) {
             return new Error('Flow requires the PHP extension "%s" to be available.', $errorKey, [$extension]);
         }
     }
     foreach ($this->requiredFunctions as $function => $errorKey) {
         if (!function_exists($function)) {
             return new Error('Flow requires the PHP function "%s" to be available.', $errorKey, [$function]);
         }
     }
     // TODO: Check for database drivers? PDO::getAvailableDrivers()
     $method = new \ReflectionMethod(__CLASS__, __FUNCTION__);
     $docComment = $method->getDocComment();
     if ($docComment === false || $docComment === '') {
         return new Error('Reflection of doc comments is not supported by your PHP setup. Please check if you have installed an accelerator which removes doc comments.', 1329405326);
     }
     set_time_limit(0);
     if (ini_get('session.auto_start')) {
         return new Error('Flow requires the PHP setting "session.auto_start" set to off.', 1224003190);
     }
     return null;
 }
开发者ID:neos,项目名称:setup,代码行数:38,代码来源:BasicRequirements.php


注:本文中的phpversion函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。