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


PHP dl函数代码示例

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


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

示例1: phpFreaksCrypto

 function phpFreaksCrypto($key = 'a843l?nv89rjfd}O(jdnsleken0', $iv = false, $algorithm = 'tripledes', $mode = 'ecb')
 {
     if (extension_loaded('mcrypt') === FALSE) {
         $prefix = PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : '';
         dl($prefix . 'mcrypt.' . PHP_SHLIB_SUFFIX) or die('The Mcrypt module could not be loaded.');
     }
     if ($mode != 'ecb' && $iv === false) {
         /*
           the iv must remain the same from encryption to decryption and is usually
           passed into the encrypted string in some form, but not always.
         */
         die('In order to use encryption modes other then ecb, you must specify a unique and consistent initialization vector.');
     }
     // set mcrypt mode and cipher
     $this->td = mcrypt_module_open($algorithm, '', $mode, '');
     // Unix has better pseudo random number generator then mcrypt, so if it is available lets use it!
     //$random_seed = strstr(PHP_OS, "WIN") ? MCRYPT_RAND : MCRYPT_DEV_RANDOM;
     $random_seed = MCRYPT_RAND;
     // if initialization vector set in constructor use it else, generate from random seed
     $iv = $iv === false ? mcrypt_create_iv(mcrypt_enc_get_iv_size($this->td), $random_seed) : substr($iv, 0, mcrypt_enc_get_iv_size($this->td));
     // get the expected key size based on mode and cipher
     $expected_key_size = mcrypt_enc_get_key_size($this->td);
     // we dont need to know the real key, we just need to be able to confirm a hashed version
     $key = substr(md5($key), 0, $expected_key_size);
     // initialize mcrypt library with mode/cipher, encryption key, and random initialization vector
     mcrypt_generic_init($this->td, $key, $iv);
 }
开发者ID:rbianco3,项目名称:phppickem,代码行数:27,代码来源:crypto.php

示例2: CheckExtension

/**
* check if SQLite extension is loaded, and if not load it.
*/
function CheckExtension($extName)
{
    $SQL_SERVER_OS = strtoupper(substr(PHP_OS, 0, 3));
    if ($SQL_SERVER_OS == 'WIN') {
        $preffix = 'php_';
        $suffix = '.dll';
    } elseif ($SQL_SERVER_OS == 'NET') {
        $preffix = 'php_';
        $suffix = '.nlm';
    } elseif ($SQL_SERVER_OS == 'LIN' || $SQL_SERVER_OS == 'DAR') {
        $preffix = '';
        $suffix = '.so';
    }
    $extensions = get_loaded_extensions();
    foreach ($extensions as $key => $ext) {
        $extensions[$key] = strtolower($ext);
    }
    if (!extension_loaded($extName) && !in_array($extName, get_loaded_extensions())) {
        if (DEBUG) {
            $oldLevel = error_reporting();
            error_reporting(E_ERROR);
            $extensionLoaded = dl($preffix . $extName . $suffix);
            error_reporting($oldLevel);
        } else {
            $extensionLoaded = @dl($preffix . $extName . $suffix);
        }
        if ($extensionLoaded) {
            return true;
        } else {
            return false;
        }
    } else {
        return true;
    }
}
开发者ID:racontemoi,项目名称:mamp,代码行数:38,代码来源:common.lib.php

示例3: load_gd

 static function load_gd()
 {
     if (!extension_loaded("gd")) {
         dprint("Warning No gd <br> ");
         dl("gd." . PHP_SHLIB_SUFFIX);
     }
 }
开发者ID:digideskio,项目名称:hypervm,代码行数:7,代码来源:coreFfilelib.php

示例4: __construct

 /**
  * construct
  *
  */
 public function __construct(array $options)
 {
     // 加载扩展
     if (!extension_loaded('snmp_plugin')) {
         dl('snmp_plugin.' . PHP_SHLIB_SUFFIX);
     }
     // 检测需要的类
     $classes = array('PHPSnmpEngine', 'SnmpServerInfo', 'PHPSystemDescRequest', 'PHPEnumCPUUtilizationRateRequest', 'PHPEnumNetworkRequest', 'PHPEnumStorageRequest', 'PHPEnumDiskIORequest');
     foreach ($classes as $class) {
         if (!class_exists($class)) {
             throw new Oray_Exception("Class {$class} not exist");
         }
     }
     // 初始化配置
     while (list($name, $value) = each($options)) {
         if (array_key_exists($name, $this->_options)) {
             $this->_options[$name] = $value;
         }
     }
     // 设置配置到SnmpServerInfo类
     $ServerInfo = new SnmpServerInfo();
     foreach ($this->_options as $name => $value) {
         $ServerInfo->{$name} = $value;
     }
     // 设置连接超时
     $ServerInfo->connect_server_timeout = 20000;
     // 实例化引擎、连接服务器
     $this->_snmpEngine = new PHPSnmpEngine();
     $this->_snmpEngine->ConnectSnmpServer($ServerInfo);
 }
开发者ID:bjtenao,项目名称:tudu-web,代码行数:34,代码来源:Snmp.php

示例5: loadLibrary

 /**
  * Loads a dynamic library.
  *
  * @see     php://dl
  * @param   string name
  * @return  bool TRUE if the library was loaded, FALSE if it was already loaded
  * @throws  lang.IllegalAccessException in case library loading is prohibited
  * @throws  lang.ElementNotFoundException in case the library does not exist
  * @throws  lang.RuntimeError in case dl() fails
  */
 public function loadLibrary($name)
 {
     if (extension_loaded($name)) {
         return false;
     }
     // dl() will fatal if any of these are set - prevent this
     if (!(bool) ini_get('enable_dl') || (bool) ini_get('safe_mode')) {
         throw new IllegalAccessException(sprintf('Loading libraries not permitted by system configuration [enable_dl= %s, safe_mode= %s]', ini_get('enable_dl'), ini_get('safe_mode')));
     }
     // Qualify filename
     $path = rtrim(realpath(ini_get('extension_dir')), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
     $filename = $name . '.' . PHP_SHLIB_SUFFIX;
     // Try php_<name>.<ext>, <name>.<ext>
     if (file_exists($lib = $path . 'php_' . $filename)) {
         // E.g. php_sybase_ct.dll
     } else {
         if (file_exists($lib = $path . $filename)) {
             // E.g. sybase_ct.so
         } else {
             throw new ElementNotFoundException('Cannot find library "' . $name . '" in "' . $path . '"');
         }
     }
     // Found library, try to load it. dl() expects given argument to not contain
     // a path and will fail with "Temporary module name should contain only
     // filename" if it does.
     if (!dl(basename($lib))) {
         throw new RuntimeError('dl() failed for ' . $lib);
     }
     return true;
 }
开发者ID:johannes85,项目名称:core,代码行数:40,代码来源:Runtime.class.php

示例6: sso_auth

 function sso_auth()
 {
     $auth_check = TRUE;
     $non_check_uri = array('remote', 'auth');
     if (isset($_SERVER['PATH_INFO'])) {
         $path_info = $_SERVER['PATH_INFO'];
         foreach ($non_check_uri as $uri) {
             if (strpos($path_info, $uri) === 1) {
                 $auth_check = FALSE;
                 break;
             }
         }
     }
     if (!extension_loaded('haes')) {
         if (phpversion() >= '5.0') {
             @dl('haes.so');
         } else {
             @dl(HOME_PATH . '../approval/lib/haes.so');
         }
     }
     $this->_load_global_config();
     if ($auth_check) {
         $this->_check_auth();
         $this->_load_timezone_config($GLOBALS['_HANBIRO_GW']['ID']);
     }
 }
开发者ID:nguyennm621992,项目名称:helppage,代码行数:26,代码来源:sso.php

示例7: in

 protected function in()
 {
     $path_to_phpgroupware = dirname(__FILE__) . '/../..';
     // need to be adapted if this script is moved somewhere else
     $_GET['domain'] = 'default';
     $GLOBALS['phpgw_info']['flags'] = array('currentapp' => 'login', 'noapi' => True);
     /**
      * Include phpgroupware header
      */
     include $path_to_phpgroupware . '/header.inc.php';
     unset($GLOBALS['phpgw_info']['flags']['noapi']);
     $db_type = $GLOBALS['phpgw_domain'][$_GET['domain']]['db_type'];
     if ($db_type == 'postgres') {
         $db_type = 'pgsql';
     }
     if (!extension_loaded($db_type) && !dl($db_type . '.so')) {
         echo "Extension '{$db_type}' is not loaded and can't be loaded via dl('{$db_type}.so') !!!\n";
     }
     $GLOBALS['phpgw_info']['server']['sessions_type'] = 'db';
     /**
      * Include API functions
      */
     include PHPGW_API_INC . '/functions.inc.php';
     for ($i = 0; $i < 10; $i++) {
         restore_error_handler();
         //Remove at least 10 levels of custom error handling
     }
     for ($i = 0; $i < 10; $i++) {
         restore_exception_handler();
         //Remove at least 10 levels of custom exception handling
     }
     $this->initializeContext();
 }
开发者ID:HaakonME,项目名称:porticoestate,代码行数:33,代码来源:entryPoint.php

示例8: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!class_exists('Event')) {
         dl('event.so');
     }
     $listen = $input->getOption('listen');
     if ($listen === null) {
         $listen = 8080;
     }
     $this->socket = new SocketIO();
     $this->socket->on('addme', function (Event\MessageEvent $messageEvent) {
         return $this->onAddme($messageEvent);
     })->on('msg', function (Event\MessageEvent $messageEvent) {
         return $this->onMsg($messageEvent);
     });
     $this->socket->listen($listen)->onConnect(function () {
     })->onRequest('/brocast', function ($connection, \EventHttpRequest $request) {
         if ($request->getCommand() == \EventHttpRequest::CMD_POST) {
             if (($data = json_decode($request->getInputBuffer()->read(1024), true)) !== NULL) {
                 $response = $this->onBrocast($data);
             } else {
                 $response = new Response('fail', Response::HTTP_NOT_FOUND);
             }
         } else {
             $response = new Response('fail', Response::HTTP_NOT_FOUND);
         }
         $connection->sendResponse($response);
     })->dispatch();
 }
开发者ID:RickySu,项目名称:chat-demo,代码行数:29,代码来源:ChatServerCommand.php

示例9: getInstance

 /**
  * Singleton Pattern, Unique Instance of This
  *
  * @param $config_file mixed
  * @param $queueIndex
  *
  * @return static
  */
 public static function getInstance($config_file = null, $queueIndex = null)
 {
     if (PHP_SAPI != 'cli' || isset($_SERVER['HTTP_HOST'])) {
         die("This script can be run only in CLI Mode.\n\n");
     }
     declare (ticks=10);
     set_time_limit(0);
     if (static::$__INSTANCE === null) {
         if (!extension_loaded("pcntl") && (bool) ini_get("enable_dl")) {
             dl("pcntl.so");
         }
         if (!function_exists('pcntl_signal')) {
             $msg = "****** PCNTL EXTENSION NOT LOADED. KILLING THIS PROCESS COULD CAUSE UNPREDICTABLE ERRORS ******";
             static::_TimeStampMsg($msg);
         } else {
             static::_TimeStampMsg(str_pad(" Registering signal handlers ", 60, "*", STR_PAD_BOTH));
             pcntl_signal(SIGTERM, array(get_called_class(), 'sigSwitch'));
             pcntl_signal(SIGINT, array(get_called_class(), 'sigSwitch'));
             pcntl_signal(SIGHUP, array(get_called_class(), 'sigSwitch'));
             $msg = str_pad(" Signal Handler Installed ", 60, "-", STR_PAD_BOTH);
             static::_TimeStampMsg("{$msg}");
         }
         static::$__INSTANCE = new static($config_file, $queueIndex);
     }
     return static::$__INSTANCE;
 }
开发者ID:bcrazvan,项目名称:MateCat,代码行数:34,代码来源:AbstractDaemon.php

示例10: testModule

 /**
  * Checks required modules
  * 
  * @param string $name
  * @param array $directive
  * @return boolean 
  */
 public function testModule($name, $directive = array())
 {
     $return = array("title" => $directive['title'], "name" => $name, "current" => "", "test" => false);
     if (is_array($directive)) {
         //If the extension is loaded
         if (!extension_loaded($name)) {
             $return["current"] = t("Not Loaded");
             //If we require this module loaded, then fail
             if ($directive["loaded"]) {
                 $return["test"] = "Failed";
             }
             //If we require this module to be installed
             if ($directive["installed"] && function_exists('dl')) {
                 if (!dl($name)) {
                     $return["test"] = "Failed";
                     $return["current"] = t("Not Installed");
                 }
             }
         } else {
             $return["current"] = _("Loaded");
             if ($directive["loaded"]) {
                 $return["test"] = "Passed";
             }
         }
         //@TODO If we have alternative modules
         if (!$return['test'] && isset($directive['alternate'])) {
             //$altName =
         }
     }
     return $return;
 }
开发者ID:budkit,项目名称:budkit-cms,代码行数:38,代码来源:Requirements.php

示例11: __construct

 function __construct($sid, $verificaSID = true)
 {
     if (!function_exists('ms_GetVersion')) {
         if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) {
             if (!@dl('php_mapscript_48.dll')) {
                 dl('php_mapscript.dll');
             }
         } else {
             dl('php_mapscript.so');
         }
     }
     //include("../../classesphp/carrega_ext.php");
     //verifica��o de seguran�a
     if ($verificaSID == true) {
         $_SESSION = array();
         session_name("i3GeoPHP");
         session_id($sid);
         session_start();
         if (@$_SESSION["fingerprint"]) {
             $f = explode(",", $_SESSION["fingerprint"]);
             if (md5('I3GEOSEC' . $_SERVER['HTTP_USER_AGENT'] . session_id()) != $f[0] && !in_array($_GET["telaR"], $f)) {
                 exit;
             }
         } else {
             exit;
         }
     }
     if (!isset($_SESSION["map_file"])) {
         exit;
     }
     $this->map_file = $_SESSION["map_file"];
     $this->postgis_mapa = $_SESSION["postgis_mapa"];
     $this->url = $_SESSION["tmpurl"];
     $this->ext = $_SESSION["mapext"];
 }
开发者ID:edmarmoretti,项目名称:i3geo,代码行数:35,代码来源:TME_i3geo_DataConnector.php

示例12: __construct

 function __construct()
 {
     global $config_vars, $cache;
     require_once Environment::getBasePath() . 'classes' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . 'InstallSchema.class.php';
     $this->config_vars = $config_vars;
     //Disable caching so we don't exceed maximum memory settings.
     $cache->_onlyMemoryCaching = TRUE;
     ini_set('default_socket_timeout', 5);
     ini_set('allow_url_fopen', 1);
     //As of PHP v5.3 some SAPI's don't support dl(), however it appears that php.ini can still have it enabled.
     //Double check to make sure the dl() function exists prior to calling it.
     if (version_compare(PHP_VERSION, '5.3.0', '<') and function_exists('dl') == TRUE and (bool) ini_get('enable_dl') == TRUE and (bool) ini_get('safe_mode') == FALSE) {
         $prefix = PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : '';
         if (extension_loaded('mysql') == FALSE) {
             @dl($prefix . 'mysql.' . PHP_SHLIB_SUFFIX);
         }
         if (extension_loaded('mysqli') == FALSE) {
             @dl($prefix . 'mysqli.' . PHP_SHLIB_SUFFIX);
         }
         if (extension_loaded('pgsql') == FALSE) {
             @dl($prefix . 'pgsql.' . PHP_SHLIB_SUFFIX);
         }
     }
     return TRUE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:25,代码来源:Install.class.php

示例13: get

 /**
  * Get file contents from temp file
  * @return string
  */
 public function get()
 {
     if (!file_exists($this->tempName)) {
         throw new BadMethodCallException('Called before being fetched with Zip->get(). Don\'t call this directly!');
     }
     switch ($this->method) {
         case 8:
             $_method = 'gzinflate';
             break;
         case 12:
             if (!extension_loaded('bz2')) {
                 @dl(strtolower(substr(PHP_OS, 0, 3)) == 'win' ? 'php_bz2.dll' : 'bz2.so');
             }
             if (extension_loaded('bz2')) {
                 $_method = 'bzdecompress';
                 break;
             } else {
                 throw new RuntimeException('Unable to decompress, failed to load bz2 extension');
             }
         default:
             $_method = false;
     }
     if ($_method) {
         return call_user_func_array($_method, array(file_get_contents($this->tempName) . $this->purge()));
     } else {
         return file_get_contents($this->tempName) . $this->purge();
     }
 }
开发者ID:stnvh,项目名称:php-partialzip,代码行数:32,代码来源:PartialData.php

示例14: init

 function init()
 {
     if (extension_loaded("imap")) {
         return true;
     }
     $prefix = PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : '';
     $EXTENSION = $prefix . 'imap.' . PHP_SHLIB_SUFFIX;
     if (function_exists('dl')) {
         $fatalMessage = 'The system tried to load dynamically the ' . $EXTENSION . ' extension';
         $fatalMessage .= '<br/>If you see this message, that means the system could not load this PHP extension';
         $fatalMessage .= '<br/>Please enable the PHP Extension ' . $EXTENSION;
         ob_start();
         echo $fatalMessage;
         dl($EXTENSION);
         $warnings = str_replace($fatalMessage, '', ob_get_clean());
         if (extension_loaded("imap") or function_exists('imap_open')) {
             return true;
         }
     }
     if ($this->report) {
         acymailing::display('The extension "' . $EXTENSION . '" could not be loaded, please change your PHP configuration to enable it', 'error');
         if (!empty($warnings)) {
             acymailing::display($warnings, 'warning');
         }
     }
     return false;
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:27,代码来源:bounce.php

示例15: setUpBeforeClass

 /**
  * Sets up the shared fixture.
  *
  * @return void
  * @link   http://phpunit.de/manual/current/en/fixtures.html#fixtures.sharing-fixture
  */
 public static function setUpBeforeClass()
 {
     if (self::$ext) {
         $name = strtolower(self::$ext);
         self::$obj = new ExtensionFactory($name);
     }
     if (!self::$obj instanceof ReferenceInterface) {
         self::$obj = null;
         return;
     }
     self::$ext = $extname = self::$obj->getName();
     self::$optionalreleases = array();
     if (!extension_loaded($extname)) {
         // if dynamic extension load is activated
         $loaded = (bool) ini_get('enable_dl');
         if ($loaded) {
             // give a second chance
             $prefix = PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : '';
             @dl($prefix . $extname . '.' . PHP_SHLIB_SUFFIX);
         }
     }
     if (!extension_loaded($extname)) {
         self::$obj = null;
     } else {
         $releases = array_keys(self::$obj->getReleases());
         $currentVersion = self::$obj->getCurrentVersion();
         // platform dependant
         foreach ($releases as $rel_version) {
             if (version_compare($currentVersion, $rel_version, 'lt')) {
                 array_push(self::$optionalreleases, $rel_version);
             }
         }
     }
 }
开发者ID:bjork,项目名称:php-compat-info,代码行数:40,代码来源:GenericTest.php


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