當前位置: 首頁>>代碼示例>>PHP>>正文


PHP tsload函數代碼示例

本文整理匯總了PHP中tsload函數的典型用法代碼示例。如果您正苦於以下問題:PHP tsload函數的具體用法?PHP tsload怎麽用?PHP tsload使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了tsload函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: autoload

 /**
  * 係統自動加載ThinkPHP類庫
  * 並且支持配置自動加載路徑
  * @param string $classname 對象類名
  */
 public static function autoload($classname)
 {
     // 檢查是否存在別名定義
     if (tsload($classname)) {
         return;
     }
     // 自動加載當前項目的Actioon類和Model類
     if (substr($classname, -5) == 'Model') {
         tsload(APP_MODEL_PATH . '/' . $classname . '.class.php');
     } elseif (substr($classname, -6) == 'Action') {
         tsload(APP_ACTION_PATH . '/' . $classname . '.class.php');
     } else {
         // 根據自動加載路徑設置進行嘗試搜索
         if (tsconfig('APP_AUTOLOAD_PATH')) {
             $paths = explode(',', tsconfig('APP_AUTOLOAD_PATH'));
             foreach ($paths as $path) {
                 if (tsload($path . '/' . $classname . '.class.php')) {
                     // 如果加載類成功則返回
                     return;
                 }
             }
         }
     }
     return;
 }
開發者ID:medz,項目名稱:thinksns-4,代碼行數:30,代碼來源:Think.class.php

示例2: getHooksList

 /**
  * 獲取該插件所需的鉤子列表
  * @param string $name 插件名稱
  * @return array 插件所需的鉤子列表
  */
 public function getHooksList($name)
 {
     $hooks = $this->getHooksInfo();
     $hooksBase = get_class_methods('Hooks');
     $list = array();
     // 生成插件列表
     foreach ($hooks['list'] as $value) {
         $dirName = ADDON_PATH . DIRECTORY_SEPARATOR . 'plugins';
         tsload($this->path . DIRECTORY_SEPARATOR . 'hooks' . DIRECTORY_SEPARATOR . $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;
 }
開發者ID:lyhiving,項目名稱:icampus,代碼行數:31,代碼來源:NormalAddons.class.php

示例3: _initialize

 /**
  * 初始化方法,生成部門的樹形對象模型
  * @return void
  */
 public function _initialize()
 {
     $field = array('id' => 'department_id', 'name' => 'title', 'pid' => 'parent_dept_id', 'sort' => 'display_order');
     tsload(ADDON_PATH . '/model/CateTreeModel');
     $this->treeDo = new CateTreeModel('department');
     $this->treeDo->setField($field);
 }
開發者ID:yang7hua,項目名稱:hunshe,代碼行數:11,代碼來源:DepartmentModel.class.php

示例4: __construct

 /**
  * 初始化方法,加載phpmailer,初始化默認參數
  * @return void
  */
 public function __construct()
 {
     tsload(ADDON_PATH . '/library/phpmailer/class.phpmailer.php');
     tsload(ADDON_PATH . '/library/phpmailer/class.pop3.php');
     tsload(ADDON_PATH . '/library/phpmailer/class.smtp.php');
     $emailset = model('Xdata')->get('admin_Config:email');
     $this->option = array('email_sendtype' => $emailset['email_sendtype'], 'email_host' => $emailset['email_host'], 'email_port' => $emailset['email_port'], 'email_ssl' => $emailset['email_ssl'], 'email_account' => $emailset['email_account'], 'email_password' => $emailset['email_password'], 'email_sender_name' => $emailset['email_sender_name'], 'email_sender_email' => $emailset['email_sender_email'], 'email_reply_account' => $emailset['email_sender_email']);
 }
開發者ID:yang7hua,項目名稱:hunshe,代碼行數:12,代碼來源:MailModel.class.php

示例5: save_charge

 function save_charge()
 {
     $data['charge_value'] = floatval($_REQUEST['charge_value']);
     $data['charge_score'] = floatval($_REQUEST['charge_score']);
     tsload(ADDON_PATH . '/library/WxPayPubHelper/WxPayPubHelper.php');
     // 		dump(WxPayConf_pub::APPID);
     // 		dump(WxPayConf_pub::MCHID);
     // 		dump(WxPayConf_pub::KEY);
     // 		dump(WxPayConf_pub::APPSECRET);
     // 		dump(WxPayConf_pub::NOTIFY_URL);
     $out_trade_no = $_REQUEST["out_trade_no"];
     empty($out_trade_no) && ($out_trade_no = 'e2e5096d574976e8f115a8f1e0ffb52b');
     // 使用訂單查詢接口
     $orderQuery = new OrderQuery_pub();
     $orderQuery->setParameter("out_trade_no", "{$out_trade_no}");
     // 商戶訂單號
     // 獲取訂單查詢結果
     $orderQueryResult = $orderQuery->getResult();
     // 商戶根據實際情況設置相應的處理流程,此處僅作舉例
     if ($orderQueryResult["return_code"] == "FAIL") {
         return array('status' => 0, 'msg' => "通信出錯:" . $orderQueryResult['return_msg']);
     } elseif ($orderQueryResult["result_code"] == "FAIL") {
         return array('status' => 0, 'msg' => "錯誤代碼:" . $orderQueryResult['err_code'] . " " . "錯誤代碼描述:" . $orderQueryResult['err_code_des']);
     } elseif ($data['charge_value'] != $orderQueryResult['total_fee']) {
         return array('status' => 0, 'msg' => "對賬失敗");
     }
     // 		echo "交易狀態:" . $orderQueryResult ['trade_state'] . "<br>";
     // 		echo "設備號:" . $orderQueryResult ['device_info'] . "<br>";
     // 		echo "用戶標識:" . $orderQueryResult ['openid'] . "<br>";
     // 		echo "是否關注公眾賬號:" . $orderQueryResult ['is_subscribe'] . "<br>";
     // 		echo "交易類型:" . $orderQueryResult ['trade_type'] . "<br>";
     // 		echo "付款銀行:" . $orderQueryResult ['bank_type'] . "<br>";
     // 		echo "總金額:" . $orderQueryResult ['total_fee'] . "<br>";
     // 		echo "現金券金額:" . $orderQueryResult ['coupon_fee'] . "<br>";
     // 		echo "貨幣種類:" . $orderQueryResult ['fee_type'] . "<br>";
     // 		echo "微信支付訂單號:" . $orderQueryResult ['transaction_id'] . "<br>";
     // 		echo "商戶訂單號:" . $orderQueryResult ['out_trade_no'] . "<br>";
     // 		echo "商家數據包:" . $orderQueryResult ['attach'] . "<br>";
     // 		echo "支付完成時間:" . $orderQueryResult ['time_end'] . "<br>";
     $data['serial_number'] = t($_REQUEST['serial_number']);
     $data['uid'] = $this->mid;
     // TODO 以下信息海全需要從財富通接口取
     $data['charge_order'] = t($_REQUEST['charge_order']);
     $data['charge_type'] = intval($_REQUEST['charge_type']);
     $data['ctime'] = intval($_REQUEST['ctime']);
     $data['status'] = intval($_REQUEST['status']);
     M('credit_charge')->add($data);
     $des['content'] = "充值了" . $data['charge_score'] . "積分";
     model('Credit')->setUserCredit($data['uid'], array('name' => 'credit_charge', 'score' => $data['charge_score']), 1, $des);
     return array('status' => 1, 'msg' => '充值成功');
 }
開發者ID:songhongyu,項目名稱:THINKSNS,代碼行數:51,代碼來源:CreditApi.class.php

示例6: connect

 /**
  * 連接緩存
  * @access public
  * @param string $type 緩存類型
  * @param array $options  配置數組
  * @return object
  */
 public function connect($type = '', $options = array())
 {
     if (empty($type)) {
         $type = C('DATA_CACHE_TYPE');
     }
     $type = strtolower(trim($type));
     $class = 'Cache' . ucwords($type);
     tsload(ADDON_PATH . '/library/cache/' . $class . '.class.php');
     if (class_exists($class)) {
         $cache = new $class($options);
     } else {
         throw_exception(L('_CACHE_TYPE_INVALID_') . ':' . $type);
     }
     return $cache;
 }
開發者ID:lyhiving,項目名稱:icampus,代碼行數:22,代碼來源:Cache.class.php

示例7: tsload

<?php

/**
 * 緩存模型 - 業務邏輯模型
 * @example
 * setType($type)						主動設置緩存類型
 * set($key, $value, $expire = null)	設置緩存key=>value,expire表示有效時間,null表示永久
 * get($key, $mutex = false)			獲取緩存數據,支持mutex模式
 * getList($prefix, $key)				批量獲取指定前綴下的多個key值的緩存
 * rm($key)								刪除緩存
 * @author jason <yangjs17@yeah.net> 
 * @version TS3.0
 */
// 加載緩存操作類
tsload(CORE_LIB_PATH . '/Cache.class.php');
class CacheModel
{
    //public static $_cacheHash = array();	// 緩存的靜態變量
    protected $handler;
    // 操作句柄
    protected $type = 'FILE';
    // 緩存類型,默認為文件緩存
    /**
     * 初始化緩存模型對象,緩存類型
     * @return void
     */
    public function __construct($type = '')
    {
        $type = model('Xdata')->get('cacheconfig:cachetype');
        // 		$type = empty($type) ? C('DATA_CACHE_TYPE') : $type;
        !$type && ($type = $this->type);
開發者ID:naliduo,項目名稱:ThinkSNS,代碼行數:31,代碼來源:CacheModel.class.php

示例8: save_charge

 public function save_charge()
 {
     $data['charge_value'] = floatval($_REQUEST['charge_value']);
     $data['charge_score'] = floatval($_REQUEST['charge_score']);
     tsload(ADDON_PATH . '/library/WxPayPubHelper/WxPayPubHelper.php');
     // 		dump(WxPayConf_pub::APPID);
     // 		dump(WxPayConf_pub::MCHID);
     // 		dump(WxPayConf_pub::KEY);
     // 		dump(WxPayConf_pub::APPSECRET);
     // 		dump(WxPayConf_pub::NOTIFY_URL);
     $out_trade_no = $_REQUEST['out_trade_no'];
     empty($out_trade_no) && ($out_trade_no = 'e2e5096d574976e8f115a8f1e0ffb52b');
     // 使用訂單查詢接口
     $orderQuery = new OrderQuery_pub();
     $orderQuery->setParameter('out_trade_no', "{$out_trade_no}");
     // 商戶訂單號
     // 獲取訂單查詢結果
     $orderQueryResult = $orderQuery->getResult();
     // 商戶根據實際情況設置相應的處理流程,此處僅作舉例
     if ($orderQueryResult['return_code'] == 'FAIL') {
         return array('status' => 0, 'msg' => '通信出錯:' . $orderQueryResult['return_msg']);
     } elseif ($orderQueryResult['result_code'] == 'FAIL') {
         return array('status' => 0, 'msg' => '錯誤代碼:' . $orderQueryResult['err_code'] . ' ' . '錯誤代碼描述:' . $orderQueryResult['err_code_des']);
     } elseif ($data['charge_value'] != $orderQueryResult['total_fee']) {
         return array('status' => 0, 'msg' => '對賬失敗');
     }
     $data['serial_number'] = t($_REQUEST['serial_number']);
     $data['uid'] = $this->mid;
     // TODO 以下信息海全需要從積分通接口取
     $data['charge_order'] = t($_REQUEST['charge_order']);
     $data['charge_type'] = intval($_REQUEST['charge_type']);
     $data['ctime'] = intval($_REQUEST['ctime']);
     $data['status'] = intval($_REQUEST['status']);
     M('credit_charge')->add($data);
     $des['content'] = '充值了' . $data['charge_score'] . '積分';
     model('Credit')->setUserCredit($data['uid'], array('name' => 'credit_charge', 'score' => $data['charge_score']), 1, $des);
     return array('status' => 1, 'msg' => '充值成功');
 }
開發者ID:medz,項目名稱:thinksns-4,代碼行數:38,代碼來源:CreditApi.class.php

示例9: verify

 /**
  * 獲取驗證碼圖片操作
  */
 public function verify()
 {
     tsload(ADDON_PATH . '/library/Image.class.php');
     tsload(ADDON_PATH . '/library/String.class.php');
     Image::buildImageVerify();
 }
開發者ID:yang7hua,項目名稱:hunshe,代碼行數:9,代碼來源:IndexAction.class.php

示例10: tsautoload

/**
 * 係統自動加載函數
 * @param string $classname 對象類名
 * @return void
 */
function tsautoload($classname)
{
    // 檢查是否存在別名定義
    if (tsload($classname)) {
        return;
    }
    // 自動加載當前項目的Actioon類和Model類
    if (substr($classname, -5) == "Model") {
        if (!tsload(ADDON_PATH . '/model/' . $classname . '.class.php')) {
            tsload(APP_LIB_PATH . '/Model/' . $classname . '.class.php');
        }
    } elseif (substr($classname, -6) == "Action") {
        tsload(APP_LIB_PATH . '/Action/' . $classname . '.class.php');
    } elseif (substr($classname, -6) == "Widget") {
        if (!tsload(ADDON_PATH . '/widget/' . $classname . '.class.php')) {
            tsload(APP_LIB_PATH . '/Widget/' . $classname . '.class.php');
        }
    } elseif (substr($classname, -6) == "Addons") {
        if (!tsload(ADDON_PATH . '/plugin/' . $classname . '.class.php')) {
            tsload(APP_LIB_PATH . '/Plugin/' . $classname . '.class.php');
        }
    } else {
        $paths = array(ADDON_PATH . '/library');
        foreach ($paths as $path) {
            if (tsload($path . '/' . $classname . '.class.php')) {
                // 如果加載類成功則返回
                return;
            }
        }
    }
    return;
}
開發者ID:317703064,項目名稱:ssat,代碼行數:37,代碼來源:core.php

示例11: execWidget

 /**
  * 執行Widget控製器
  */
 public static function execWidget()
 {
     //防止CSRF
     if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST' && stripos($_SERVER['HTTP_REFERER'], SITE_URL) !== 0 && $_SERVER['HTTP_USER_AGENT'] !== 'Shockwave Flash' && strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'adobe flash player') === false && MODULE_NAME != 'Weixin') {
         die('illegal request.');
     }
     $className = MODULE_NAME . 'Widget';
     if (!class_exists($className)) {
         if (file_exists(APP_PATH . '/Lib/Widget/' . MODULE_NAME . 'Widget/' . MODULE_NAME . 'Widget.class.php')) {
             tsload(APP_PATH . '/Lib/Widget/' . MODULE_NAME . 'Widget/' . MODULE_NAME . 'Widget.class.php');
         } else {
             tsload(APPS_PATH . '/' . $_GET['app_widget'] . '/Lib/Widget/' . MODULE_NAME . 'Widget/' . MODULE_NAME . 'Widget.class.php');
         }
     }
     $module = new $className();
     //異常處理
     if (!$module) {
         // 模塊不存在 拋出異常
         throw_exception(L('_MODULE_NOT_EXIST_') . MODULE_NAME);
     }
     //獲取當前操作名
     $action = ACTION_NAME;
     //執行當前操作
     if ($rs = call_user_func(array(&$module, $action))) {
         echo $rs;
     }
     return;
 }
開發者ID:medz,項目名稱:thinksns-4,代碼行數:31,代碼來源:App.class.php

示例12: tsload

<?php

/**
 * 標準插件抽象。該插件具備插件的標準行為。
 * 獲取信息,以及該插件擁有的管理操作
 * @author sampeng
 *
 */
tsload(CORE_LIB_PATH . '/addons/AbstractAddons.class.php');
abstract class SimpleAddons extends AbstractAddons
{
    private $name;
    private $hooklist = array();
    /**
     * getHooksList
     * 獲取該插件的所有鉤子列表
     * @access public
     * @return void
     */
    public function getHooksList($name)
    {
        $this->name = $name;
        $this->getHooksInfo();
        return $this->hooklist;
    }
    //管理麵板
    public function adminMenu()
    {
        return array();
    }
    //注冊hook位該執行的方法
開發者ID:lyhiving,項目名稱:icampus,代碼行數:31,代碼來源:SimpleAddons.class.php

示例13: parse

 /**
  * 模板解析入口
  * 支持普通標簽和TagLib解析 支持自定義標簽庫
  * @access public
  * @param string $content 要解析的模板內容
  * @return string
  */
 public function parse($content)
 {
     // 內容為空不解析
     if (empty($content)) {
         return '';
     }
     $begin = $this->config['taglib_begin'];
     $end = $this->config['taglib_end'];
     // 檢查include語法
     $content = $this->parseInclude($content);
     // 檢查PHP語法
     $content = $this->parsePhp($content);
     // 首先替換literal標簽內容
     $content = preg_replace('/' . $begin . 'literal' . $end . '(.*?)' . $begin . '\\/literal' . $end . '/eis', "\$this->parseLiteral('\\1')", $content);
     // 獲取需要引入的標簽庫列表
     // 標簽庫隻需要定義一次,允許引入多個一次
     // 一般放在文件的最前麵
     // 格式:<taglib name="html,mytag..." />
     // 當TAGLIB_LOAD配置為true時才會進行檢測
     if (C('TAGLIB_LOAD')) {
         $this->getIncludeTagLib($content);
         if (!empty($this->tagLib)) {
             // 對導入的TagLib進行解析
             $_taglibs = C('_taglibs_');
             foreach ($this->tagLib as $tagLibName) {
                 // 內置標簽庫
                 if (!tsload(CORE_LIB_PATH . '/TagLib/TagLib' . ucwords(strtolower($tagLibName)) . '.class.php')) {
                     // 擴展標簽庫
                     if ($_taglibs && isset($_taglibs[$tagLibName])) {
                         tsload(CORE_LIB_PATH . '/TagLib/TagLib' . $_taglibs[$tagLibName] . '.class.php');
                     } else {
                         throw_exception($tagLibName . L('_TAGLIB_NOT_EXIST_'));
                     }
                 }
                 $this->parseTagLib($tagLibName, $content);
             }
         }
     }
     // 預先加載的標簽庫 無需在每個模板中使用taglib標簽加載
     if (C('TAGLIB_PRE_LOAD')) {
         $tagLibs = explode(',', C('TAGLIB_PRE_LOAD'));
         foreach ((array) $taglibs as $tag) {
             $this->parseTagLib($tag, $content);
         }
     }
     // 內置標簽庫 無需使用taglib標簽導入就可以使用
     $tagLibs = explode(',', C('TAGLIB_BUILD_IN'));
     foreach ($tagLibs as $tag) {
         $this->parseTagLib($tag, $content, true);
     }
     //解析普通模板標簽 {tagName:}
     $content = preg_replace('/(' . $this->config['tmpl_begin'] . ')(\\S.+?)(' . $this->config['tmpl_end'] . ')/eis', "\$this->parseTag('\\2')", $content);
     return $content;
 }
開發者ID:songhongyu,項目名稱:THINKSNS,代碼行數:61,代碼來源:Template.class.php

示例14: createSystemConfigPHPFile

 /**
  * 官方服務器生成後台頁麵配置信息
  *
  * @return [type] void
  */
 public function createSystemConfigPHPFile()
 {
     set_time_limit(0);
     // 判斷文件夾路徑是否存在
     if (!file_exists(LANG_PATH)) {
         mkdir(LANG_PATH, 0777);
     }
     $data = D('system_config')->findAll();
     $fileName = LANG_PATH . '/system_config.php';
     // 權限處理
     $fp = fopen($fileName, 'w+');
     $fileData = "<?php\n";
     $fileData .= "return array(\n";
     foreach ($data as $val) {
         $val['value'] = unserialize($val['value']);
         $arr = 'array(';
         if ($val['value']['key']) {
             $arr .= '\'key\'=>array(';
             foreach ($val['value']['key'] as $k0 => $v0) {
                 $arr .= '\'' . $k0 . '\'=>\'' . htmlspecialchars($v0, ENT_QUOTES) . '\',';
             }
             $arr .= '),';
         }
         if ($val['value']['key_name']) {
             $arr .= '\'key_name\'=>array(';
             foreach ($val['value']['key_name'] as $k1 => $v1) {
                 $arr .= '\'' . $k1 . '\'=>\'' . htmlspecialchars($v1, ENT_QUOTES) . '\',';
             }
             $arr .= '),';
         }
         if ($val['value']['key_hidden']) {
             $arr .= '\'key_hidden\'=>array(';
             foreach ($val['value']['key_hidden'] as $k2 => $v2) {
                 $arr .= '\'' . $k2 . '\'=>\'' . htmlspecialchars($v2, ENT_QUOTES) . '\',';
             }
             $arr .= '),';
         }
         if ($val['value']['key_type']) {
             $arr .= '\'key_type\'=>array(';
             foreach ($val['value']['key_type'] as $k3 => $v3) {
                 $arr .= '\'' . $k3 . '\'=>\'' . htmlspecialchars($v3, ENT_QUOTES) . '\',';
             }
             $arr .= '),';
         }
         if ($val['value']['key_default']) {
             $arr .= '\'key_default\'=>array(';
             foreach ($val['value']['key_default'] as $k4 => $v4) {
                 $arr .= '\'' . $k4 . '\'=>\'' . htmlspecialchars($v4, ENT_QUOTES) . '\',';
             }
             $arr .= '),';
         }
         if ($val['value']['key_tishi']) {
             $arr .= '\'key_tishi\'=>array(';
             foreach ($val['value']['key_tishi'] as $k5 => $v5) {
                 $arr .= '\'' . $k5 . '\'=>\'' . htmlspecialchars($v5, ENT_QUOTES) . '\',';
             }
             $arr .= '),';
         }
         if ($val['value']['key_javascript']) {
             $arr .= '\'key_javascript\'=>array(';
             foreach ($val['value']['key_javascript'] as $k6 => $v6) {
                 $arr .= '\'' . $k6 . '\'=>\'' . htmlspecialchars($v6, ENT_QUOTES) . '\',';
             }
             $arr .= ')';
         }
         $arr .= ')';
         if (empty($val['key']) || empty($val['list']) || $arr == 'array()') {
             continue;
         }
         $content[] = "'{$val['key']}-{$val['list']}'=>" . $arr;
     }
     $fileData .= implode(",\n", $content);
     $fileData .= "\n);";
     fwrite($fp, $fileData);
     fclose($fp);
     unset($fileData);
     unset($content);
     @chmod($fileName, 0775);
     tsload(ADDON_PATH . '/library/Update.class.php');
     $updateClass = new Update();
     $res = $updateClass->zipPackage($fileName, LANG_PATH, 'system_config', LANG_PATH);
     unlink($fileName);
     echo $res;
 }
開發者ID:medz,項目名稱:thinksns-4,代碼行數:89,代碼來源:ToolAction.class.php

示例15: upload

 /**
  * 上傳文件
  * @access public
  * @param string $savePath  上傳文件保存路徑
  * @return string
  * @throws ThinkExecption
  */
 public function upload($savePath = '')
 {
     if (!$this->isOpen()) {
         $this->error = '沒有開啟雲圖片功能';
         return false;
     }
     $fileInfo = array();
     $isUpload = false;
     // 獲取上傳的文件信息,對$_FILES數組信息處理
     $files = $this->dealFiles($_FILES);
     foreach ($files as $key => $file) {
         //過濾無效的上傳
         if (!empty($file['name'])) {
             $file['key'] = $key;
             $file['extension'] = $this->getExt($file['name']);
             if ($this->savePath) {
                 $file['savepath'] = $this->savePath;
             } else {
                 $file['savepath'] = $this->customPath;
             }
             if ($this->saveName) {
                 $file['savename'] = $this->saveName;
             } else {
                 $file['savename'] = uniqid() . "." . $file['extension'];
             }
             //移動設備上傳的無後綴的圖片,默認為jpg
             if ($GLOBALS['fromMobile'] == true && empty($file['extension'])) {
                 $file['extension'] = 'jpg';
                 $file['savename'] = trim($file['savename'], '.') . '.jpg';
             } elseif ($this->autoCheck) {
                 if (!$this->check($file)) {
                     return false;
                 }
             }
             //計算hash
             if (function_exists($this->hashType)) {
                 $fun = $this->hashType;
                 $file['hash'] = $fun($file['tmp_name']);
             }
             //上傳到雲服務器
             $config = $this->getConfig();
             tsload(ADDON_PATH . '/library/upyun.class.php');
             $cloud = new UpYun($config['cloud_image_bucket'], $config['cloud_image_admin'], $config['cloud_image_password']);
             $cloud->setTimeout(60);
             $file_content = file_get_contents($file['tmp_name']);
             $res = $cloud->writeFile('/' . $file['savepath'] . $file['savename'], $file_content, true);
             if (!$res) {
                 $this->error = '上傳到雲服務器失敗!';
                 return false;
             }
             //上傳成功後保存文件信息,供其它地方調用
             unset($file['tmp_name'], $file['error'], $file_content);
             $fileInfo[] = $file;
             $isUpload = true;
         }
     }
     if ($isUpload) {
         $this->uploadFileInfo = $fileInfo;
         return true;
     } else {
         $this->error = '上傳出錯!文件不符合上傳要求。';
         return false;
     }
 }
開發者ID:omusico,項目名稱:ThinkSNS-4,代碼行數:71,代碼來源:CloudImageModel.class.php


注:本文中的tsload函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。