本文整理汇总了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;
}
}