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


PHP iPHP::throwException方法代码示例

本文整理汇总了PHP中iPHP::throwException方法的典型用法代码示例。如果您正苦于以下问题:PHP iPHP::throwException方法的具体用法?PHP iPHP::throwException怎么用?PHP iPHP::throwException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iPHP的用法示例。


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

示例1: run

 public static function run($args = NULL, $prefix = "do_")
 {
     self::init();
     $app = $_GET['app'];
     $app or $app = 'home';
     //in_array($app, self::$apps) OR iPHP::throwException('运行出错!找不到应用程序:' . $app, 1001);
     $do or $do = $_GET['do'] ? (string) $_GET['do'] : 'iCMS';
     if ($_POST['action']) {
         $do = $_POST['action'];
         $prefix = 'ACTION_';
     }
     self::$app_name = $app;
     self::$app_do = $do;
     self::$app_method = $prefix . $do;
     self::$app_path = ACP_PATH;
     self::$app_tpl = ACP_PATH . '/template';
     self::$app_file = ACP_PATH . '/' . $app . '.app.php';
     define('APP_URI', __ADMINCP__ . '=' . $app);
     define('APP_FURI', APP_URI . '&frame=iPHP');
     define('APP_DOURI', APP_URI . ($do != 'iCMS' ? '&do=' . $do : ''));
     define('APP_BOXID', self::$app_name . '-box');
     define('APP_FORMID', 'iCMS-' . APP_BOXID);
     is_file(self::$app_file) or iPHP::throwException('运行出错!找不到文件: <b>' . self::$app_name . '.app.php</b>', 1002);
     iPHP::import(self::$app_file);
     $appName = self::$app_name . 'App';
     self::$app = new $appName();
     $app_methods = get_class_methods($appName);
     in_array(self::$app_method, $app_methods) or iPHP::throwException('运行出错! <b>' . self::$app_name . '</b> 类中找不到方法定义: <b>' . self::$app_method . '</b>', 1003);
     $method = self::$app_method;
     $args === null && ($args = self::$app_args);
     if ($args) {
         if ($args === 'object') {
             return self::$app;
         }
         return self::$app->{$method}($args);
     } else {
         return self::$app->{$method}();
     }
 }
开发者ID:Junred,项目名称:iCMS,代码行数:39,代码来源:iACP.class.php

示例2: do_download

 function do_download()
 {
     $this->bakdir or iPHP::alert('请选择要下载的备份卷');
     @ini_set('memory_limit', '256M');
     require iPHP_CORE . '/pclzip.class.php';
     //加载zip操作类
     $zipname = $this->bakdir . ".zip";
     //压缩包的名称
     $zipFile = iPHP_APP_CACHE . '/backup/' . $zipname;
     //压缩包所在路径
     $zip = new PclZip($zipFile);
     $backupdir = iPHP_APP_CACHE . '/backup/' . $this->bakdir;
     $fileArray = glob($backupdir . '/iCMS_*.sql');
     $filelist = implode(',', $fileArray);
     $v_list = $zip->create($filelist, PCLZIP_OPT_REMOVE_PATH, iPHP_APP_CACHE . '/backup/');
     //将文件进行压缩
     $v_list == 0 && iPHP::throwException("压缩出错 : " . $zip->errorInfo(true));
     //如果有误,提示错误信息。
     ob_end_clean();
     header("Content-Type: application/force-download");
     header("Content-Transfer-Encoding: binary");
     header('Content-Type: application/zip');
     header('Content-Disposition: attachment; filename=' . $zipname);
     header('Content-Length: ' . filesize($zipFile));
     readfile($zipFile);
     flush();
     ob_flush();
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:28,代码来源:database.app.php

示例3: get_app

 public static function get_app($appid = 1)
 {
     $rs = iCache::get('iCMS/app/' . $appid);
     $rs or iPHP::throwException('app no exist', '0005');
     return $rs;
 }
开发者ID:sunhk25,项目名称:iCMS,代码行数:6,代码来源:iAPP.class.php

示例4: charsetTrans

 public static function charsetTrans($html, $content_charset, $encode, $out = 'UTF-8')
 {
     if (spider::$dataTest || spider::$ruleTest) {
         echo '<b>规则设置编码:</b>' . $encode . '<br />';
     }
     $encode == 'auto' && ($encode = null);
     /**
      * 检测http返回的编码
      */
     if ($content_charset) {
         $content_charset = rtrim($content_charset, ';');
         if (empty($encode)) {
             $encode = $content_charset;
         } else {
             if (strtoupper($encode) != strtoupper($content_charset)) {
                 $encode = $content_charset;
             }
         }
         if (strtoupper($encode) == $out) {
             if (spider::$dataTest || spider::$ruleTest) {
                 echo '<b>检测页面编码:</b>' . $encode . '<br />';
             }
             return $html;
         }
     }
     /**
      * 检测页面编码
      */
     if (empty($encode)) {
         preg_match('/<meta[^>]*?charset=(["\']?)([a-zA-z0-9\\-\\_]+)(\\1)[^>]*?>/is', $html, $charset);
         $encode = str_replace(array('"', "'"), '', trim($charset[2]));
     }
     if (function_exists('mb_detect_encoding') && empty($encode)) {
         $encode = mb_detect_encoding($html, array("ASCII", "UTF-8", "GB2312", "GBK", "BIG5"));
     }
     if (spider::$dataTest || spider::$ruleTest) {
         echo '<b>检测页面编码:</b>' . $encode . '<br />';
     }
     if (strtoupper($encode) == $out) {
         return $html;
     }
     $html = preg_replace('/(<meta[^>]*?charset=(["\']?))[a-z\\d_\\-]*(\\2[^>]*?>)/is', "\\1{$out}\\3", $html, 1);
     if (function_exists('mb_convert_encoding')) {
         return mb_convert_encoding($html, $out, $encode);
     } elseif (function_exists('iconv')) {
         return iconv($encode, $out, $html);
     } else {
         iPHP::throwException('charsetTrans failed, no function');
     }
 }
开发者ID:Junred,项目名称:iCMS,代码行数:50,代码来源:iSpider.Tools.php

示例5: charsetTrans

 function charsetTrans($html, $content_charset, $encode, $out = 'UTF-8')
 {
     if ($encode == 'auto') {
         preg_match('/<meta[^>]*?charset=(["\']?)([a-zA-z0-9\\-\\_]+)(\\1)[^>]*?>/is', $html, $charset);
         $encode = str_replace(array('"', "'"), '', trim($charset[2]));
         if ($content_charset) {
             $encode = $content_charset;
         }
         if (function_exists('mb_detect_encoding') && empty($encode)) {
             $encode = mb_detect_encoding($html, array("ASCII", "UTF-8", "GB2312", "GBK", "BIG5"));
             //var_dump('mb_detect_encoding:'.$encode);
         }
     }
     if ($this->contTest || $this->ruleTest) {
         echo 'encoding:' . $encode . '<br />';
     }
     if (strtoupper($encode) == 'UTF-8') {
         return $html;
     }
     $html = preg_replace('/(<meta[^>]*?charset=(["\']?))[a-z\\d_\\-]*(\\2[^>]*?>)/is', "\\1{$out}\\3", $html, 1);
     if (function_exists('mb_convert_encoding')) {
         return mb_convert_encoding($html, 'UTF-8', $encode);
     } elseif (function_exists('iconv')) {
         return iconv($encode, 'UTF-8', $html);
     } else {
         iPHP::throwException('charsetTrans failed, no function');
     }
 }
开发者ID:World3D,项目名称:iCMS,代码行数:28,代码来源:spider.app.php


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