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


PHP require_array函数代码示例

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


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

示例1: start

 /**
  * 应用程序初始化
  */
 public static function start()
 {
     // 加载默认配置
     C(include CONF_PATH . '/convention.php');
     date_default_timezone_set(C('DEFAULT_TIMEZONE'));
     // 环境变量
     putenv('LC_ALL=C');
     putenv('LANG="zh_CN.UTF-8"');
     spl_autoload_register(array('M3d', 'autoload'));
     require_array(array(LIB_PATH . '/Core/Dispatcher.class.php', LIB_PATH . '/Core/Model.class.php', LIB_PATH . '/Core/Action.class.php', LIB_PATH . '/Core/View.class.php', LIB_PATH . '/Core/Tool.class.php', LIB_PATH . '/Core/Plugin.class.php'));
     define('REQUEST_METHOD', strtolower($_SERVER['REQUEST_METHOD']));
     define('IS_GET', REQUEST_METHOD === 'get');
     define('IS_POST', REQUEST_METHOD === 'post');
     define('IS_PUT', REQUEST_METHOD === 'put');
     define('IS_DELETE', REQUEST_METHOD === 'delete');
     define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest');
     Tool::start();
     Plugin::start();
     // 加载全局配置
     C(include C('M3D_CONF_PATH') . '/config.php');
     // 加载project配置
     C(include PROJECT_PATH . '/conf/config.php');
     Dispatcher::dispatch();
     self::exec();
 }
开发者ID:chenyongze,项目名称:m3d,代码行数:28,代码来源:M3d.class.php

示例2: 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_s($options);
     //对象实例存在
     if (isset(self::$cacheFactory->cacheList[$driverName])) {
         return self::$cacheFactory->cacheList[$driverName];
     }
     $class = 'Cache' . ucwords(strtolower($driver));
     //缓存驱动
     $classFile = YY_PATH . 'Cache/' . $class . '.class.php';
     //加载驱动类库文件
     if (!require_array($classFile)) {
         halt("缓存类型指定错误,不存在缓存驱动文件:" . $classFile);
     }
     $cacheObj = new $class($options);
     self::$cacheFactory->cacheList[$driverName] = $cacheObj;
     return self::$cacheFactory->cacheList[$driverName];
 }
开发者ID:kumfo,项目名称:YYphp,代码行数:25,代码来源:CacheFactory.class.php

示例3: autoload

 private static function autoload($className)
 {
     $class = ucfirst($className) . '.class.php';
     if (substr($className, -5) == "Model") {
         if (require_array(array(MODEL_PATH . $class, HDPHP_DRIVER_PATH . 'Model/' . $class, COMMON_MODEL_PATH . $class))) {
             return;
         }
     } elseif (substr($className, -7) == "Control") {
         if (require_array(array(CONTROL_PATH . $class, HDPHP_CORE_PATH . $class, COMMON_CONTROL_PATH . $class))) {
             return;
         }
     } elseif (substr($className, 0, 2) == 'Db') {
         if (require_array(array(HDPHP_DRIVER_PATH . 'Db/' . $class))) {
             return;
         }
     } elseif (substr($className, 0, 5) == "Cache") {
         if (require_array(array(HDPHP_DRIVER_PATH . 'Cache/' . $class))) {
             return;
         }
     } elseif (substr($className, 0, 7) == "Session") {
         if (require_array(array(HDPHP_DRIVER_PATH . 'Session/' . $class))) {
             return;
         }
     } elseif (substr($className, -5) == "Event") {
         if (require_array(array(EVENT_PATH . $class, COMMON_EVENT_PATH . $class))) {
             return;
         }
     } elseif (alias_import($className)) {
         return;
     } elseif (require_array(array(EVENT_PATH . $class, LIB_PATH . $class, TAG_PATH . $class, COMMON_LIB_PATH . $class, HDPHP_CORE_PATH . $class, HDPHP_EXTEND_PATH . $class, HDPHP_EXTEND_PATH . '/Tool/' . $class))) {
         return;
     }
     $msg = "Class {$class} not found";
     Log::write($msg);
     error($msg);
 }
开发者ID:sxau-web-team,项目名称:wish-web,代码行数:36,代码来源:Boot.php

示例4: autoload

 /**
  * 系统自动加载ThinkPHP类库
  * 并且支持配置自动加载路径
  * @param string $class 对象类名
  * @return void
  */
 public static function autoload($class)
 {
     // 检查是否存在别名定义
     if (alias_import($class)) {
         return;
     }
     $libPath = defined('BASE_LIB_PATH') ? BASE_LIB_PATH : LIB_PATH;
     $group = defined('GROUP_NAME') && C('APP_GROUP_MODE') == 0 ? GROUP_NAME . '/' : '';
     $file = $class . '.class.php';
     if (substr($class, -8) == 'Behavior') {
         // 加载行为
         if (require_array(array(CORE_PATH . 'Behavior/' . $file, EXTEND_PATH . 'Behavior/' . $file, LIB_PATH . 'Behavior/' . $file, $libPath . 'Behavior/' . $file), true) || defined('MODE_NAME') && require_cache(MODE_PATH . ucwords(MODE_NAME) . '/Behavior/' . $file)) {
             return;
         }
     } elseif (substr($class, -5) == 'Model') {
         // 加载模型
         if (require_array(array(LIB_PATH . 'Model/' . $group . $file, $libPath . 'Model/' . $file, EXTEND_PATH . 'Model/' . $file), true)) {
             return;
         }
     } elseif (substr($class, -6) == 'Action') {
         // 加载控制器
         if (require_array(array(LIB_PATH . 'Action/' . $group . $file, $libPath . 'Action/' . $file, EXTEND_PATH . 'Action/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 5) == 'Cache') {
         // 加载缓存驱动
         if (require_array(array(EXTEND_PATH . 'Driver/Cache/' . $file, CORE_PATH . 'Driver/Cache/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 2) == 'Db') {
         // 加载数据库驱动
         if (require_array(array(EXTEND_PATH . 'Driver/Db/' . $file, CORE_PATH . 'Driver/Db/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 8) == 'Template') {
         // 加载模板引擎驱动
         if (require_array(array(EXTEND_PATH . 'Driver/Template/' . $file, CORE_PATH . 'Driver/Template/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 6) == 'TagLib') {
         // 加载标签库驱动
         if (require_array(array(EXTEND_PATH . 'Driver/TagLib/' . $file, CORE_PATH . 'Driver/TagLib/' . $file), true)) {
             return;
         }
     }
     // 根据自动加载路径设置进行尝试搜索
     $paths = explode(',', C('APP_AUTOLOAD_PATH'));
     foreach ($paths as $path) {
         if (import($path . '.' . $class)) {
             // 如果加载类成功则返回
             return;
         }
     }
 }
开发者ID:ysking,项目名称:commlib,代码行数:60,代码来源:Think.class.php

示例5: autoload

 /**
  * The system automatically loads the library Senthot
  * And Support configure automatic loading path
  * @param string $class Object class name
  * @return void
  */
 public static function autoload($class)
 {
     // Check for alias definitions
     if (alias_import($class)) {
         return;
     }
     $libPath = defined('BASE_LIB_PATH') ? BASE_LIB_PATH : LIB_PATH;
     $group = defined('GROUP_NAME') && C('APP_GROUP_MODE') == 0 ? GROUP_NAME . '/' : '';
     $file = $class . '.class.php';
     if (substr($class, -8) == 'Behavior') {
         // Load Behavior
         if (require_array(array(CORE_PATH . 'Behavior/' . $file, ADDONS_PATH . 'Behavior/' . $file, LIB_PATH . 'Behavior/' . $file, $libPath . 'Behavior/' . $file), true) || defined('MODE_NAME') && require_cache(MODE_PATH . ucwords(MODE_NAME) . '/Behavior/' . $file)) {
             return;
         }
     } elseif (substr($class, -5) == 'Model') {
         // Load Model
         if (require_array(array(LIB_PATH . 'Model/' . $group . $file, $libPath . 'Model/' . $file, ADDONS_PATH . 'Model/' . $file), true)) {
             return;
         }
     } elseif (substr($class, -6) == 'Action') {
         // Load Controller
         if (require_array(array(LIB_PATH . 'Action/' . $group . $file, $libPath . 'Action/' . $file, ADDONS_PATH . 'Action/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 5) == 'Cache') {
         // Load cache drive
         if (require_array(array(ADDONS_PATH . 'Driver/Cache/' . $file, CORE_PATH . 'Driver/Cache/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 2) == 'Db') {
         // Load database driver
         if (require_array(array(ADDONS_PATH . 'Driver/Db/' . $file, CORE_PATH . 'Driver/Db/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 8) == 'Template') {
         // Loading template engine driven
         if (require_array(array(ADDONS_PATH . 'Driver/Template/' . $file, CORE_PATH . 'Driver/Template/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 6) == 'TagLib') {
         // Load tag library drive
         if (require_array(array(ADDONS_PATH . 'Driver/TagLib/' . $file, CORE_PATH . 'Driver/TagLib/' . $file), true)) {
             return;
         }
     }
     // According to the settings automatically load path try to search
     $paths = explode(',', C('APP_AUTOLOAD_PATH'));
     foreach ($paths as $path) {
         if (import($path . '.' . $class)) {
             // If you load the class success, returns
             return;
         }
     }
 }
开发者ID:davidpersson,项目名称:FrameworkBenchmarks,代码行数:60,代码来源:Sen.class.php

示例6: autoload

 public static function autoload($class)
 {
     if (alias_import($class)) {
         return;
     }
     $libPath = defined('BASE_LIB_PATH') ? BASE_LIB_PATH : LIB_PATH;
     $group = defined('GROUP_NAME') && C('APP_GROUP_MODE') == 0 ? GROUP_NAME . '/' : '';
     $file = $class . '.class.php';
     if (substr($class, -8) == 'Behavior') {
         if (require_array(array(CORE_PATH . 'Behavior/' . $file, EXTEND_PATH . 'Behavior/' . $file, LIB_PATH . 'Behavior/' . $file, $libPath . 'Behavior/' . $file), true) || defined('MODE_NAME') && require_cache(MODE_PATH . ucwords(MODE_NAME) . '/Behavior/' . $file)) {
             return;
         }
     } elseif (substr($class, -5) == 'Model') {
         $model = ucwords(str_replace('Model', "", $class));
         if (require_array(array(LIB_PATH . 'Model/' . $group . $file, $libPath . 'Model/' . $file, EXTEND_PATH . 'Model/' . $file, APP_PATH . C("APP_GROUP_PATH") . "/{$model}/Model/{$class}.class.php"), true)) {
             return;
         }
     } elseif (substr($class, -6) == 'Action') {
         if (require_array(array(LIB_PATH . 'Action/' . $group . $file, $libPath . 'Action/' . $file, EXTEND_PATH . 'Action/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 5) == 'Cache') {
         if (require_array(array(EXTEND_PATH . 'Driver/Cache/' . $file, CORE_PATH . 'Driver/Cache/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 2) == 'Db') {
         if (require_array(array(EXTEND_PATH . 'Driver/Db/' . $file, CORE_PATH . 'Driver/Db/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 8) == 'Template') {
         if (require_array(array(EXTEND_PATH . 'Driver/Template/' . $file, CORE_PATH . 'Driver/Template/' . $file), true)) {
             return;
         }
     } elseif (substr($class, 0, 6) == 'TagLib') {
         if (require_array(array(EXTEND_PATH . 'Driver/TagLib/' . $file, CORE_PATH . 'Driver/TagLib/' . $file, LIB_PATH . "/TagLib/{$class}.class.php"), true)) {
             return;
         }
     } elseif (substr($class, -6) == 'TagLib') {
         if (require_cache(LIB_PATH . "/TagLib/{$class}.class.php")) {
             return;
         }
     } elseif (substr($class, -7) == 'Service') {
         if (require_cache(LIB_PATH . "/Service/{$class}.class.php")) {
             return;
         }
     } elseif (substr($class, 0, 10) == 'Attachment') {
         if (require_cache(LIB_PATH . "/Driver/Attachment/{$class}.class.php")) {
             return;
         }
     } elseif (substr($class, 0, 8) == 'Passport') {
         if (require_cache(LIB_PATH . "/Driver/Passport/{$class}.class.php")) {
             return;
         }
     } elseif (in_array($class, array('content_update', 'content_output', 'content_input', 'content_form', 'content_delete'))) {
         if (require_cache(RUNTIME_PATH . "{$class}.class.php")) {
             return;
         } else {
             D("Content_cache")->model_content_cache();
             if (is_file(RUNTIME_PATH . "{$class}.class.php")) {
                 include RUNTIME_PATH . "{$class}.class.php";
             }
         }
     } else {
         if (require_cache(LIB_PATH . "/Util/{$class}.class.php")) {
             return;
         }
     }
     $paths = explode(',', C('APP_AUTOLOAD_PATH'));
     foreach ($paths as $path) {
         if (import($path . '.' . $class)) {
             return;
         }
     }
 }
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:74,代码来源:~runtime.php

示例7: __autoload

function __autoload($class)
{
    if (substr($class, -10) == 'Controller') {
        require_array(array(CONTROLLER_PATH . $class . '.class.php', YY_PATH . $class . '.class.php'));
    } else {
        if (substr($class, -5) == 'Model') {
            require_array(array(MODEL_PATH . $class . '.class.php', YY_PATH . $class . '.class.php'));
        } elseif (substr($class, 0, 2) == 'Db') {
            require_array(array(YY_PATH . 'Driver/Db/' . $class . '.class.php'));
        } elseif (substr($class, -5) == 'Cache') {
            require_array(array(YY_PATH . 'Core/' . $class . '.class.php'));
        }
    }
}
开发者ID:kumfo,项目名称:YYphp,代码行数:14,代码来源:functions.php

示例8: control

/**
 * 实例化控制器并执行方法
 * @param $control 控制器
 * @param null $method 方法
 * @param array $args 参数
 * @return bool|mixed
 */
function control($class, $method = NULl, $args = array())
{
    $class = $class . C('CONTROL_FIX');
    $classfile = $class . '.class.php';
    if (require_array(array(HDPHP_CORE_PATH . $classfile, CONTROL_PATH . $classfile, COMMON_CONTROL_PATH . $classfile))) {
        if (class_exists($class)) {
            $obj = new $class();
            if ($method && method_exists($obj, $method)) {
                return call_user_func_array(array(&$obj, $method), $args);
            }
            return $obj;
        }
    } else {
        return false;
    }
}
开发者ID:jyht,项目名称:v5,代码行数:23,代码来源:Functions.php

示例9: autoload

 /**
  * 自动载入函数
  * @param string $className 类名
  * @access private
  * @return void
  */
 public static function autoload($className)
 {
     $class = ucfirst($className) . '.class.php';
     //类文件
     if (substr($className, -5) == 'Model' && require_array(array(HDPHP_DRIVER_PATH . 'Model/' . $class, MODULE_MODEL_PATH . $class, APP_MODEL_PATH . $class))) {
         return;
     } elseif (substr($className, -10) == 'Controller' && require_array(array(HDPHP_CORE_PATH . $class, MODULE_CONTROLLER_PATH . $class, APP_CONTROLLER_PATH . $class))) {
         return;
     } elseif (substr($className, 0, 2) == 'Db' && require_array(array(HDPHP_DRIVER_PATH . 'Db/' . $class))) {
         return;
     } elseif (substr($className, 0, 5) == 'Cache' && require_array(array(HDPHP_DRIVER_PATH . 'Cache/' . $class))) {
         return;
     } elseif (substr($className, 0, 4) == 'View' && require_array(array(HDPHP_DRIVER_PATH . 'View/' . $class))) {
         return;
     } elseif (substr($className, -4) == 'Hook' && require_array(array(MODULE_HOOK_PATH . $class, APP_HOOK_PATH . $class))) {
         return;
     } elseif (substr($className, -5) == 'Addon' && require_array(array(APP_ADDON_PATH . $class))) {
         return;
     } elseif (substr($className, -3) == 'Tag' && require_array(array(APP_TAG_PATH . $class, MODULE_TAG_PATH . $class))) {
         return;
     } elseif (substr($className, -7) == 'Storage' && require_array(array(HDPHP_DRIVER_PATH . 'Storage/' . $class))) {
         return;
     } elseif (alias_import($className)) {
         return;
     } elseif (require_array(array(MODULE_LIB_PATH . $class, APP_LIB_PATH . $class, HDPHP_CORE_PATH . $class, HDPHP_EXTEND_PATH . '/Tool/' . $class))) {
         return;
     }
 }
开发者ID:hdbaiyu,项目名称:HDPHP,代码行数:34,代码来源:HDPHP.class.php

示例10: loadParseTags

 private function loadParseTags()
 {
     $tagClass = array();
     $tags = C('TPL_TAGS');
     if (!empty($tags) && is_array($tags)) {
         foreach ($tags as $file) {
             $file = str_replace(".", "/", $file);
             $info = explode("/", $file);
             $class = array_pop($info);
             if (class_exists($class, false)) {
             } else {
                 if (require_array(array(TAG_PATH . $file . '.class.php', COMMON_TAG_PATH . $file . '.class.php'))) {
                 } else {
                     if (import($file)) {
                     } else {
                         if (DEBUG) {
                             halt("标签类文件{$class}不存在");
                         } else {
                             continue;
                         }
                     }
                 }
             }
             $tmp = explode(".", $class);
             $tagClass[] = array_pop($tmp);
         }
     }
     if (import('HDPHP.Lib.Driver.View.ViewTag')) {
         $tagClass[] = 'ViewTag';
         $this->parseTagClass($tagClass);
     }
 }
开发者ID:jyht,项目名称:v5,代码行数:32,代码来源:~boot.php

示例11: autoload

 /**
  * 自动载入函数
  * @param string $className 类名
  * @access private
  * @return void
  */
 public static function autoload($className)
 {
     $class = ucfirst($className) . '.class.php';
     //类文件
     if (substr($className, -5) == 'Model') {
         if (require_array(array(HDPHP_DRIVER_PATH . 'Model/' . $class, MODEL_PATH . $class, COMMON_MODEL_PATH . $class))) {
             return;
         }
     } elseif (substr($className, -7) == 'Control') {
         if (require_array(array(HDPHP_CORE_PATH . $class, CONTROL_PATH . $class, COMMON_CONTROL_PATH . $class))) {
             return;
         }
     } elseif (substr($className, 0, 2) == 'Db') {
         if (require_array(array(HDPHP_DRIVER_PATH . 'Db/' . $class))) {
             return;
         }
     } elseif (substr($className, 0, 5) == 'Cache') {
         if (require_array(array(HDPHP_DRIVER_PATH . 'Cache/' . $class))) {
             return;
         }
     } elseif (substr($className, 0, 4) == 'View') {
         if (require_array(array(HDPHP_DRIVER_PATH . 'View/' . $class))) {
             return;
         }
     } elseif (substr($className, -5) == 'Event') {
         if (require_array(array(EVENT_PATH . $class, COMMON_EVENT_PATH . $class))) {
             return;
         }
     } elseif (substr($className, -3) == 'Tag') {
         if (require_array(array(TAG_PATH . $class, COMMON_TAG_PATH . $class))) {
             return;
         }
     } elseif (substr($className, -7) == 'Storage') {
         if (require_array(array(HDPHP_DRIVER_PATH . 'Storage/' . $class))) {
             return;
         }
     } elseif (alias_import($className)) {
         return;
     } elseif (require_array(array(LIB_PATH . $class, COMMON_LIB_PATH . $class, HDPHP_CORE_PATH . $class, HDPHP_EXTEND_PATH . $class, HDPHP_EXTEND_PATH . '/Tool/' . $class))) {
         return;
     }
     $msg = "Class {$className} not found";
     Log::write($msg);
     halt($msg);
 }
开发者ID:jyht,项目名称:v5,代码行数:51,代码来源:HDPHP.class.php

示例12: loadParseTags

 /**
  * 加载标签库与解析标签
  */
 private function loadParseTags()
 {
     //标签库类
     $tagClass = array();
     //加载框架核心标签库
     if (import('HDPHP.Lib.Driver.View.ViewTag')) {
         $tagClass[] = 'ViewTag';
     }
     //加载扩展标签库
     $tags = C('TPL_TAGS');
     //如果配置文件中存在标签定义
     if (!empty($tags) && is_array($tags)) {
         //加载其他模块或应用中的标签库
         foreach ($tags as $file) {
             $file = str_replace(".", "/", $file);
             $info = explode("/", $file);
             //类名
             $class = array_pop($info);
             if (class_exists($class, false)) {
             } else {
                 if (require_array(array(MODULE_TAG_PATH . $file . '.class.php', APP_TAG_PATH . $file . '.class.php'))) {
                 } else {
                     if (import($file)) {
                     } else {
                         continue;
                     }
                 }
             }
             $tmp = explode(".", $class);
             $tagClass[] = array_pop($tmp);
         }
     }
     $this->parseTagClass($tagClass);
 }
开发者ID:www2511550,项目名称:ECSHOP,代码行数:37,代码来源:ViewCompile.class.php

示例13: edit

 /**
  * 修改内容 
  * @param array $data 数据
  * @param type $id 信息ID
  * @return boolean 
  */
 public function edit($data, $id)
 {
     require_array(array(RUNTIME_PATH . 'content_input.class.php', RUNTIME_PATH . 'content_update.class.php'));
     $this->catid = (int) $data['catid'];
     $this->modelid = $this->categorys[$this->catid]['modelid'];
     //主表操作开始
     $this->table_name = ucwords($this->Model[$this->modelid]['tablename']);
     $this->fbtable_name = $this->table_name . "_data";
     $this->Content = new ContentModel($this->table_name);
     $content_input = new content_input($this->modelid, $this);
     $inputinfo = $content_input->get($data);
     if (is_bool($inputinfo) && $inputinfo == false) {
         //显示错误
         $this->error($content_input->getError());
         return false;
     }
     //主表字段内容
     $systeminfo = $inputinfo['system'];
     //副表字段内容
     $modelinfo = $inputinfo['model'];
     //栏目数据
     $catidinfo = $this->categorys[$systeminfo['catid']];
     //setting配置
     $catidsetting = unserialize($catidinfo['setting']);
     //前台投稿状态判断
     if (defined('IN_ADMIN') && IN_ADMIN == false) {
         //前台投稿编辑是否需要审核
         if ($catidsetting['member_editcheck']) {
             $systeminfo['status'] = 1;
         }
     }
     //取得inputtime的真实发布时间
     //inputtime为真实发表时间,不允许修改
     $data['inputtime'] = $systeminfo['inputtime'] = $inputtime = $this->Content->where(array("id" => $id))->getField("inputtime");
     //更新时间处理
     if ($data['updatetime'] && !is_numeric($data['updatetime'])) {
         $systeminfo['updatetime'] = strtotime($data['updatetime']);
     } elseif (!$data['updatetime']) {
         $systeminfo['updatetime'] = time();
     } else {
         $systeminfo['updatetime'] = $data['updatetime'];
     }
     //自动提取摘要,如果有设置自动提取,且description为空,且有内容字段才执行
     if (isset($_POST['add_introduce']) && $systeminfo['description'] == '' && isset($modelinfo['content'])) {
         $content = stripslashes($modelinfo['content']);
         $introcude_length = intval($_POST['introcude_length']);
         $systeminfo['description'] = str_cut(str_replace(array("\r\n", "\t", '[page]', '[/page]', '“', '”', ' '), '', strip_tags($content)), $introcude_length);
         $inputinfo['system']['description'] = $systeminfo['description'] = Input::getVar($systeminfo['description']);
     }
     //自动提取缩略图,从content 中提取
     if (isset($_POST['auto_thumb']) && $systeminfo['thumb'] == '' && isset($modelinfo['content'])) {
         $content = $content ? $content : stripslashes($modelinfo['content']);
         $auto_thumb_no = intval($_POST['auto_thumb_no']) - 1;
         if (preg_match_all("/(src)=([\"|']?)([^ \"'>]+\\.(gif|jpg|jpeg|bmp|png))\\2/i", $content, $matches)) {
             $systeminfo['thumb'] = $matches[3][$auto_thumb_no];
         }
     }
     //转向地址
     if ($data['islink'] == 1) {
         $systeminfo['url'] = $_POST['linkurl'];
     } else {
         //生成该篇地址
         $urls = $this->url->show($id, 0, $systeminfo['catid'], $inputtime, $data['prefix'], $inputinfo, 'edit');
         $systeminfo['url'] = $urls[0];
     }
     //使用TP的自动验证,所以要把令牌合并
     $systeminfo = array_merge($systeminfo, array(C("TOKEN_NAME") => $_POST[C("TOKEN_NAME")]));
     $status = $this->Content->create($systeminfo);
     if (!$status) {
         $this->error($this->Content->getError());
     }
     //把副表的数据合并,按关联模型的需求合并
     $status['id'] = $id;
     $fdata = array($this->fbtable_name => $modelinfo);
     $status = array_merge($status, $fdata);
     //删除真实时间的信息,避免被更新
     unset($status['inputtime']);
     //数据修改,这里使用关联操作
     $this->Content->relation(true)->where(array('id' => $id))->save($status);
     //调用 update
     $content_update = new content_update($this->modelid, $id, $this);
     $data['url'] = $systeminfo['url'];
     $content_update->update($data);
     //更新附件状态,把相关附件和文章进行管理
     $this->attachment_db = service("Attachment");
     $this->attachment_db->api_update('', 'c-' . $systeminfo['catid'] . '-' . $id, 2);
     //更新到全站搜索
     if ($systeminfo['status'] == 99) {
         $this->search_api($id, $inputinfo, "updata");
     } else {
         $this->search_api($id, $inputinfo, "delete");
     }
     //生成相关
     $generatelish = 0;
//.........这里部分代码省略.........
开发者ID:BGCX262,项目名称:ztoa-svn-to-git,代码行数:101,代码来源:Content.class.php


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