本文整理匯總了PHP中require_cache函數的典型用法代碼示例。如果您正苦於以下問題:PHP require_cache函數的具體用法?PHP require_cache怎麽用?PHP require_cache使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了require_cache函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Amango_Addons_Import
/**
* 實例化 微信第三方導入
* @param 目標文件夾 類名
* @author Kevin
*/
function Amango_Addons_Import($extraclass, $addonsname, $file = 'ORG')
{
$file = empty($file) ? 'ORG' : $file;
$addonname = empty($addonsname) ? AMANGO_ADDON_NAME : $addonsname;
$extrafile = AMANGO_FILE_ROOT . '/Addons/' . ucfirst($addonname) . '/' . $file . '/' . $extraclass;
return require_cache($extrafile);
}
示例2: run
public function run(&$_data)
{
$engine = strtolower(C('TMPL_ENGINE_TYPE'));
if ('think' == $engine) {
//[sae] 采用Think模板引擎
if ($this->checkCache($_data['file'])) {
// 緩存有效
SaeMC::include_file(md5($_data['file']) . C('TMPL_CACHFILE_SUFFIX'), $_data['var']);
} else {
$tpl = Think::instance('ThinkTemplate');
// 編譯並加載模板文件
$tpl->fetch($_data['file'], $_data['var']);
}
} else {
// 調用第三方模板引擎解析和輸出
$class = 'Template' . ucwords($engine);
if (is_file(CORE_PATH . 'Driver/Template/' . $class . '.class.php')) {
// 內置驅動
$path = CORE_PATH;
} else {
// 擴展驅動
$path = EXTEND_PATH;
}
if (require_cache($path . 'Driver/Template/' . $class . '.class.php')) {
$tpl = new $class();
$tpl->fetch($_data['file'], $_data['var']);
} else {
// 類沒有定義
throw_exception(L('_NOT_SUPPERT_') . ': ' . $class);
}
}
//[sae] 添加trace信息。
trace(array('[SAE]核心緩存' => $_SERVER['HTTP_APPVERSION'] . '/' . RUNTIME_FILE, '[SAE]模板緩存' => $_SERVER['HTTP_APPVERSION'] . '/' . md5($_data['file']) . C('TMPL_CACHFILE_SUFFIX')));
}
示例3: Position_edit
/**
* 推薦位中被推送過來的信息編輯
* @param type $data
* @return boolean
*/
public function Position_edit($data)
{
if (!is_array($data)) {
return false;
}
if (!$data['posid'] || !$data['modelid'] || !$data['id']) {
return false;
}
//載入數據處理類
if (require_cache(RUNTIME_PATH . 'content_input.class.php') == false) {
return false;
}
$content_input = new content_input($data['modelid']);
//數據處理
foreach ($data['data'] as $field => $value) {
//字段類型
$func = $content_input->fields[$field]['formtype'];
if (method_exists($content_input, $func)) {
$data['data'][$field] = $content_input->{$func}($field, $value);
} else {
$data['data'][$field] = $value;
}
}
$data['data'] = serialize($data['data']);
if ($this->save($data) !== false) {
service("Attachment")->api_update('', 'position-' . $data['modelid'] . '-' . $data['id'], 1);
return true;
}
return false;
}
示例4: initConfig
public function initConfig()
{
require_cache(COMMON_PATH . "Conf/uc.php");
if (!defined('UC_API')) {
E('未發現uc配置文件,請確定配置文件位於' . COMMON_PATH . "Conf/uc.php");
}
}
示例5: send_mail
function send_mail($to, $title, $content)
{
require_cache(VENDOR_PATH . "PHPmail/PHPMailerAutoload.php");
$mail = new PHPMailer();
// $mail->SMTPDebug =3;
$mail->isSMTP();
$mail->Host = 'smtp.qq.com';
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail->Hostname = 'lero.com';
$mail->CharSet = 'utf-8';
$mail->FromName = 'lero_lin';
//昵稱
$mail->Username = '254430304';
$mail->Password = 'hlqhklajvcpkbhbg';
//此處必須填寫郵箱服務器的授權碼
$mail->From = '254430304@qq.com';
$mail->isHTML(true);
$mail->addAddress($to);
$mail->Subject = $title;
$mail->Body = $content;
$status = $mail->send();
if ($status) {
return $result = '測試成功';
} else {
return $result = '發送失敗' . $mail->ErrorInfo;
}
}
示例6: run
public function run(&$_data)
{
$engine = strtolower(C('TMPL_ENGINE_TYPE'));
if ('think' == $engine) {
// 采用Think模板引擎
if ($this->checkCache($_data['file'])) {
// 緩存有效
// 分解變量並載入模板緩存
extract($_data['var'], EXTR_OVERWRITE);
//載入模版緩存文件
include C('CACHE_PATH') . md5($_data['file']) . C('TMPL_CACHFILE_SUFFIX');
} else {
$tpl = Think::instance('ThinkTemplate');
// 編譯並加載模板文件
$tpl->fetch($_data['file'], $_data['var']);
}
} else {
// 調用第三方模板引擎解析和輸出
$class = 'Template' . ucwords($engine);
if (is_file(CORE_PATH . 'Driver/Template/' . $class . '.class.php')) {
// 內置驅動
$path = CORE_PATH;
} else {
// 擴展驅動
$path = EXTEND_PATH;
}
if (require_cache($path . 'Driver/Template/' . $class . '.class.php')) {
$tpl = new $class();
$tpl->fetch($_data['file'], $_data['var']);
} else {
// 類沒有定義
throw_exception(L('_NOT_SUPPERT_') . ': ' . $class);
}
}
}
示例7: UCenterInit
/**
* 初始化 UCenter
*/
public function UCenterInit()
{
//連接 UCenter 的方式
define("UC_CONNECT", $this->_config['uc_connect']);
//UCenter 數據庫主機
define("UC_DBHOST", $this->_config['uc_dbhost']);
//UCenter 數據庫用戶名
define("UC_DBUSER", $this->_config['uc_dbuser']);
//UCenter 數據庫密碼.
define("UC_DBPW", $this->_config['uc_dbpw']);
//UCenter 數據庫名稱
define("UC_DBNAME", $this->_config['uc_dbname']);
//UCenter 數據庫字符集
define("UC_DBCHARSET", $this->_config['uc_dbcharset']);
//UCenter 數據庫表前綴
define("UC_DBTABLEPRE", $this->_config['uc_dbtablepre']);
//與 UCenter 的通信密鑰, 要與 UCenter 保持一致
define("UC_KEY", $this->_config['uc_key']);
//UCenter 服務端的 URL 地址
define("UC_API", $this->_config['uc_api']);
//UCenter 的 IP
define("UC_IP", $this->_config['uc_ip']);
//UCenter 的字符集
define("UC_CHARSET", "utf-8");
//當前應用的 ID
define("UC_APPID", $this->_config['uc_appid']);
define('UC_PPP', '20');
$this->UCenter = TRUE;
return require_cache(SITE_PATH . DIRECTORY_SEPARATOR . "api" . DIRECTORY_SEPARATOR . "uc_client" . DIRECTORY_SEPARATOR . "client.php");
}
示例8: autoload
/**
+----------------------------------------------------------
* 係統自動加載ThinkPHP類庫
* 並且支持配置自動加載路徑
+----------------------------------------------------------
* @param string $classname 對象類名
+----------------------------------------------------------
* @return void
+----------------------------------------------------------
*/
public static function autoload($classname)
{
// 檢查是否存在別名定義
if (alias_import($classname)) {
return;
}
// 自動加載當前項目的Actioon類和Model類
if (substr($classname, -5) == "Model") {
require_cache(LIB_PATH . 'Model/' . $classname . '.class.php');
} elseif (substr($classname, -6) == "Action") {
require_cache(LIB_PATH . 'Action/' . $classname . '.class.php');
} else {
// 根據自動加載路徑設置進行嘗試搜索
if (C('APP_AUTOLOAD_PATH')) {
$paths = explode(',', C('APP_AUTOLOAD_PATH'));
foreach ($paths as $path) {
if (import($path . $classname . '.class.php')) {
// 如果加載類成功則返回
return;
}
}
}
}
return;
}
示例9: renderFile
/**
+----------------------------------------------------------
* 渲染模板輸出 供render方法內部調用
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @param string $templateFile 模板文件
* @param mixed $var 模板變量
* @param string $charset 模板編碼
+----------------------------------------------------------
* @return string
+----------------------------------------------------------
*/
protected function renderFile($templateFile = '', $var = '', $charset = 'utf-8')
{
ob_start();
ob_implicit_flush(0);
if (!file_exists_case($templateFile)) {
// 自動定位模板文件
$name = substr(get_class($this), 0, -6);
$filename = empty($templateFile) ? $name : $templateFile;
$templateFile = LIB_PATH . 'Widget/' . $name . '/' . $filename . C('TMPL_TEMPLATE_SUFFIX');
if (!file_exists_case($templateFile)) {
throw_exception(L('_TEMPLATE_NOT_EXIST_') . '[' . $templateFile . ']');
}
}
$template = $this->template ? $this->template : strtolower(C('TMPL_ENGINE_TYPE') ? C('TMPL_ENGINE_TYPE') : 'php');
if ('php' == $template) {
// 使用PHP模板
if (!empty($var)) {
extract($var, EXTR_OVERWRITE);
}
// 直接載入PHP模板
include $templateFile;
} else {
$className = 'Template' . ucwords($template);
require_cache(THINK_PATH . '/Lib/Think/Util/Template/' . $className . '.class.php');
$tpl = new $className();
$tpl->fetch($templateFile, $var, $charset);
}
$content = ob_get_clean();
return $content;
}
示例10: getHooksList
/**
* getHooksList
* 獲取該插件的所有鉤子列表
* @access public
* @return void
*/
public function getHooksList($name)
{
$hooks = $this->getHooksInfo();
$hooksBase = get_class_methods('Hooks');
$list = array();
//生成插件列表
foreach ($hooks['list'] as $value) {
$dirName = ADDON_PATH . '/plugins';
require_cache($this->path . '/hooks/' . $value . '.class.php');
$hook = array_diff(get_class_methods($value), $hooksBase);
foreach ($hook as $v) {
$list[$v][$name][] = $value;
}
}
//排序
foreach ($hooks['sort'] as $key => $value) {
if (isset($list[$name][$key])) {
$temp = array();
foreach ($value as $v) {
$temp[] = $hooks['list'][$v];
}
$list[$name][$key] = $temp;
}
}
return $list;
}
示例11: initConfig
function initConfig()
{
require_cache(MODULE_PATH . "Conf/uc.php");
if (!defined('UC_API')) {
exit('未發現uc配置文件,請確定配置文件位於' . MODULE_PATH . "Conf/uc.php");
}
}
示例12: factory
/**
* 返回工廠實例,單例模式
*/
public static function factory($options)
{
$options = is_array($options) ? $options : array();
//隻實例化一個對象
if (is_null(self::$cacheFactory)) {
self::$cacheFactory = new CacheFactory();
}
$driver = isset($options['driver']) ? $options['driver'] : C("CACHE_TYPE");
//靜態緩存實例名稱
$driverName = md5_d($options);
//對象實例存在
if (isset(self::$cacheFactory->cacheList[$driverName])) {
return self::$cacheFactory->cacheList[$driverName];
}
$class = 'Cache' . ucwords(strtolower($driver));
//緩存驅動
if (!class_exists($class)) {
$classFile = HDPHP_DRIVER_PATH . 'Cache/' . $class . '.class.php';
//加載驅動類庫文件
if (!require_cache($classFile)) {
halt("緩存類型指定錯誤,不存在緩存驅動文件:" . $classFile);
}
}
$cacheObj = new $class($options);
self::$cacheFactory->cacheList[$driverName] = $cacheObj;
return self::$cacheFactory->cacheList[$driverName];
}
示例13: __construct
public function __construct()
{
$this->name = C('TMPL_ENGINE_TYPE') ? C('TMPL_ENGINE_TYPE') : 'PHP';
$className = 'Template' . ucwords(strtolower($this->name));
require_cache(dirname(__FILE__) . '/Template/' . $className . '.class.php');
$this->_tpl = new $className();
}
示例14: autoload
/**
* 類庫自動加載
* @param string $class 對象類名
* @return bool
*/
public static function autoload($class)
{
//檢查是否存在映射
if (isset(self::$map[$class])) {
include self::$map[$class];
} elseif (false !== strpos($class, '\\')) {
$name = strstr($class, '\\', true);
if (in_array($name, array('Core', 'Driver', 'Vendor')) || is_dir(LIB_PATH . $name)) {
//Library目錄下麵的命名空間自動定位
$path = LIB_PATH;
$filename = $path . str_replace('\\', '/', $class) . EXT;
if (is_file($filename)) {
//win環境下嚴格區分大小
if (IS_WIN && false === strpos(realpath($filename), $class . EXT)) {
return;
}
include $filename;
}
} elseif (in_array($name, explode(',', C('MODULE_ALLOW_LIST')))) {
//目前應用於A()方法
require_cache(APP_PATH . $class . EXT);
}
} else {
foreach (explode(',', C('APP_AUTOLOAD_LAYER')) as $layer) {
if (substr($class, -strlen($layer)) == $layer) {
if (require_cache(MODULE_PATH . $layer . '/' . $class . EXT)) {
return true;
}
}
}
}
return true;
}
示例15: WSTSendMail
/**
* 郵件發送函數
* @param string to 要發送的郵箱地址
* @param string subject 郵件標題
* @param string content 郵件內容
* @return array
*/
function WSTSendMail($to, $subject, $content)
{
require_cache(VENDOR_PATH . "PHPMailer/class.smtp.php");
require_cache(VENDOR_PATH . "PHPMailer/class.phpmailer.php");
$mail = new PHPMailer();
// 裝配郵件服務器
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->Host = $GLOBALS['CONFIG']['mailSmtp'];
$mail->SMTPAuth = $GLOBALS['CONFIG']['mailAuth'];
$mail->Username = $GLOBALS['CONFIG']['mailUserName'];
$mail->Password = $GLOBALS['CONFIG']['mailPassword'];
$mail->CharSet = 'utf-8';
// 裝配郵件頭信息
$mail->From = $GLOBALS['CONFIG']['mailUserName'];
$mail->AddAddress($to);
$mail->FromName = $GLOBALS['CONFIG']['mailSendTitle'];
$mail->IsHTML(true);
// 裝配郵件正文信息
$mail->Subject = $subject;
$mail->Body = $content;
// 發送郵件
$rs = array();
if (!$mail->Send()) {
$rs['status'] = 0;
$rs['msg'] = $mail->ErrorInfo;
return $rs;
} else {
$rs['status'] = 1;
return $rs;
}
}