• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP highlight_file函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: db

 public function db()
 {
     //将MongoModel放入项目Lib\Model下并建一个测试的TestModel
     //将驱动放入核心的Lib\Driver\Db\下
     $mongo = D('Test');
     //显示表名
     $this->assign('table_name', $mongo->getTableName());
     //清除所有数据
     $map = array();
     $map['where'] = '1=1';
     $result = $mongo->delete($map);
     if ($result) {
         $this->assign('clear', 1);
     }
     //添加数据
     $data = array('title' => 'test', 'id' => '1');
     $mongo->add($data);
     $data['id'] = '2';
     $mongo->add($data);
     $add = $mongo->select();
     $this->assign('add', $add);
     //更新id为1的记录的title字段值设为title2
     $mongo->where(array('id' => '1'))->save(array('title' => 'title2'));
     $update = $mongo->select();
     $this->assign('update', $update);
     $action_code = highlight_file(__FILE__, 1);
     $this->assign('action_code', $action_code);
     $this->display();
 }
开发者ID:zjstage,项目名称:ThinkPHP,代码行数:29,代码来源:IndexAction.class.php


示例2: tablesrc

 function tablesrc()
 {
     header('Content-type: text/html;charset=utf8');
     $file = APP_DIR . '/' . $_GET['tableapp'] . '/dbschema/' . $_GET['tablename'] . '.php';
     echo '<div style="padding:2px 10px;border-bottom:1px solid #ccc">' . $file . '</div>';
     highlight_file($file);
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:7,代码来源:tools.php


示例3: file

 /**
  * Preview code from a PHP file
  *
  * @param string   $file       file path
  * @param int|null $activeLine active line number
  * @param int|null $lineRange  range of lines to render (around active line)
  * @param string   $className  wrapper class name
  * @return string|null
  */
 public static function file($file, $activeLine = null, $lineRange = null, $className = 'code-preview')
 {
     $highlighted = @highlight_file($file, true);
     if (false !== $highlighted) {
         return self::render($highlighted, $activeLine, $lineRange, $className);
     }
 }
开发者ID:kuria,项目名称:error,代码行数:16,代码来源:PhpCodePreview.php


示例4: indexAction

 /**
  * Index
  *
  * @return void
  */
 public function indexAction()
 {
     $this->view->navSetup = highlight_file('App/Demo/Navigation.setup.php', true);
     $this->view->navSetup = str_replace('Zym_Navigation_Demo',
                                         'Zym_Navigation',
                                         $this->view->navSetup);
 }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:12,代码来源:NavigationController.php


示例5: indexAction

 public function indexAction()
 {
     //如果邮件不能正常发送,请根据错误提示寻找原因
     //常见的问题就是没有开启IMAP/SMTP服务
     $time = microtime(1);
     $host = 'smtp.qq.com';
     $pors = 25;
     $user = 'QQ邮箱';
     $pass = '密码';
     $smtp = new emailModel($host, $pors, $user, $pass);
     $to = '接收邮箱';
     $from = $user;
     $subject = 'PHP邮件测试' . $time;
     //邮件主题
     $body = '测试成功';
     //邮件内容
     //定义如下两项后,发件人内容显示类似:PHP邮件测试<QQ邮箱>
     $from_email = $user;
     $from_name = 'PHP邮件测试';
     if ($smtp->send($to, $from, $subject, $body, $from_email, $from_name)) {
         echo '总耗时:', microtime(1) - $time;
     }
     echo '<h1>控制器源代码:</h1><hr />';
     highlight_file(__FILE__);
 }
开发者ID:baitongda,项目名称:mPHP,代码行数:25,代码来源:emailController.php


示例6: indexAction

 public function indexAction()
 {
     //调试状态关闭缓存功能,默认为调试状态。0:非调试状态 1:调试状态
     //在初始化mPHP前,可以通过配置$GLOBALS['CFG']['debug']来设定
     //初始化mPHP后,可以通过配置mPHP::$debug来设定
     mPHP::$debug = 0;
     //初始化阶段mPHP已经声明了视图类
     //mPHP::$view = new view();
     $view = mPHP::$view;
     $tpl = 'view';
     //模版名称
     $file = CACHE_PATH . "html/{$tpl}.html";
     //缓存html文件保存位置
     $time = 5;
     //缓存时间(秒)
     $cache = $view->cache($file, $time);
     if ($cache) {
         return true;
     }
     //缓存有效期内直接返回
     sleep(1);
     //模拟耗时操作
     $view->data['title'] = 'mPHP视图类缓存demo ';
     $view->data['h'] = 'hello ';
     $view->data['w'] = 'world ';
     $view->loadTpl($tpl);
     //加载模版
     highlight_file(__FILE__);
 }
开发者ID:baitongda,项目名称:mPHP,代码行数:29,代码来源:view_cacheController.php


示例7: stedisplayFileInHTML

/**
 * SmartTemplate Extension config
 * Print Content of Configuration Parameters
 *
 * Usage Example:
 * Content:  $_CONFIG['webmaster']  =  '[email protected]';
 * Template: Please Contact Webmaster: {config:"webmaster"}
 * Result:   Please Contact Webmaster: [email protected]
 *
 * @author Philipp v. Criegern [email protected]
 */
function stedisplayFileInHTML($directory, $file)
{
    if (file_exists($directory . "/" . $file)) {
        return highlight_file($directory . "/" . $file, 1);
    } else {
        return "File does not exist {$directory}, {$file}";
    }
}
开发者ID:BackupTheBerlios,项目名称:smarterdata-svn,代码行数:19,代码来源:displayFileInHTML.php


示例8: showSource

function showSource($dir, $file)
{
    $path = $dir . $file;
    echo '<div>';
    echo '<h1>' . $path . '</h1>';
    highlight_file($path);
    echo '</div>' . "\n";
}
开发者ID:aikeay,项目名称:sandbox,代码行数:8,代码来源:PHP_Debug_Sources.php


示例9: handle

 public function handle()
 {
     $types = array("php" => "text/html", "html" => "text/html", "htm" => "text/html", "css" => "text/css", "jpg" => "image/jpeg", "jpeg" => "image/jpeg", "gif" => "image/gif", "phps" => "text/html", "pdf" => "application/pdf", "" => "text/plain");
     $real_file = $this->options["rewrite"] ? $this->applyRewriteRules() : $this->request->path . "/" . $this->request->file;
     $extension = array_pop(explode(".", basename($real_file)));
     if (!in_array($extension, array_keys($types))) {
         $extension = "";
     }
     if (file_exists($this->request->document_root . $real_file)) {
         // DefaultHandler: File exists
         if ($extension == "phps") {
             $output = highlight_file($this->request->document_root . $real_file, true);
             $headers = array("Content-Type" => $types[$extension], "Content-Length" => strlen($output));
             $response = new Zend_Http_Response(200, $headers, $output);
         } else {
             if ($extension == "php") {
                 // DefaultHandler: PHP script
                 $current_directory = getcwd();
                 chdir(dirname($this->request->document_root . $real_file));
                 // Setting up globals
                 $_GET = $this->request->get;
                 $_POST = $this->request->post;
                 $_REQUEST = array_merge($_GET, $_POST);
                 $_SERVER["DOCUMENT_ROOT"] = $this->request->document_root;
                 $_SERVER["SCRIPT_FILENAME"] = $this->request->file;
                 $_SERVER["PHP_SELF"] = $this->request->path;
                 $_SERVER["SCRIPT_NAME"] = $this->request->path . "/" . $this->request->file;
                 $_SERVER["argv"] = $this->request->query_string;
                 $_SERVER["SERVER_ADDR"] = "";
                 $_SERVER["SERVER_NAME"] = "";
                 $_SERVER["SERVER_SOFTWARE"] = "Zend HTTP Server (alpha)";
                 $_SERVER["SERVER_PROTOCOL"] = "";
                 $_SERVER["REQUEST_METHOD"] = $this->request->method;
                 $_SERVER["REQUEST_TIME"] = time();
                 $_SERVER["QUERY_STRING"] = $this->request->query_string;
                 $_SERVER["REQUEST_URI"] = $this->request->uri;
                 $_SERVER["HTTP_HOST"] = $this->request->headers["Host"];
                 unset($_SERVER["argc"]);
                 $output = self::startScript($this->request->document_root . $real_file);
                 // DefaultHandler: Done.  Sending response.
                 chdir($current_directory);
                 $headers = array("Content-Type" => "text/html", "Content-Length" => strlen($output));
                 foreach (headers_list() as $header) {
                     list($name, $value) = split(":", $header);
                     $headers[$name] = $value;
                 }
                 $response = new Zend_Http_Response(200, $headers, $output);
             } else {
                 $data = file_get_contents($this->request->document_root . $real_file);
                 $response = new Zend_Http_Response(200, array("Content-Type" => $types[$extension], "Content-Length" => strlen($data)), $data);
             }
         }
     } else {
         $response = new Zend_Http_Response(404, array("Content-Type" => "text/plain"), "File Not Found!");
     }
     return $response;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:57,代码来源:DefaultHandler.php


示例10: highlight

 /**
  * Highlighter with built-in check for list of disabled function (Google AppEngine)
  *
  * @param string $file Name of the file
  */
 public static function highlight($file)
 {
     $highlightFileFunc = new \ReflectionFunction('highlight_file');
     if (!$highlightFileFunc->isDisabled()) {
         highlight_file($file);
     } else {
         echo '<pre>' . htmlspecialchars(file_get_contents($file)) . '</pre>';
     }
 }
开发者ID:alexrodrigue,项目名称:framework,代码行数:14,代码来源:Highlighter.php


示例11: dumpFile

 /**
  * Output a dump of a file
  *
  * @param mixed $file file to dump
  * @param bool  $echo true to echo dump, false to return dump as string
  *
  * @return string
  */
 public static function dumpFile($file, $echo = true)
 {
     $msg = highlight_file($file, true);
     $msg = "<div style='padding: 5px; font-weight: bold'>{$msg}</div>";
     if ($echo) {
         echo $msg;
     }
     return $msg;
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:17,代码来源:Utils.php


示例12: body

 /**
  * Displays PHP code from selected file with syntax highlighting.
  * 
  * @param string filename
  */
 public function body($arg)
 {
     print '<div align="left">';
     if (file_exists($arg)) {
         highlight_file($arg);
     } else {
         echo "File {$arg} does not exist.";
     }
     print '</div>';
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:15,代码来源:CatFile_0.php


示例13: onView

 public function onView($param)
 {
     $class = $param['source'];
     $file = "App/Control/{$class}.php";
     if (file_exists($file)) {
         $panel = new Panel('Código-fonte: ' . $class);
         $panel->add(highlight_file($file, TRUE));
         parent::add($panel);
     }
 }
开发者ID:beregueder,项目名称:phpoo,代码行数:10,代码来源:ViewSource.php


示例14: tnvExample_Change

 protected function tnvExample_Change($strFormId, $strControlId, $strParameter)
 {
     $objItem = $this->tnvExample->SelectedItem;
     if (is_dir($this->tnvExample->SelectedValue)) {
         $this->pnlCode->Text = 'Current directory is <b>' . $this->tnvExample->SelectedItem->Name . '</b>.  ' . 'Please select a file on the left';
     } else {
         $strCode = highlight_file($this->tnvExample->SelectedValue, true);
         $this->pnlCode->Text = $strCode;
     }
 }
开发者ID:qcodo,项目名称:qcodo,代码行数:10,代码来源:treenav.php


示例15: ViewSource

 public static function ViewSource()
 {
     echo '<h1>You are looking at the output from MyClass::ViewSource</h1>
       <ul>
         <li><a href="/simple-site">Call MyClass::MyMethod</a></li>
         <li><a href="/simple-site/sample">Call MyClass::MyOtherMethod</a></li>
         <li><a href="/simple-site/somepath/source">View the source of this page</a></li>
       </ul>';
     highlight_file(__FILE__);
 }
开发者ID:Jpsstack,项目名称:epiphany,代码行数:10,代码来源:index.php


示例16: view_help

 function view_help()
 {
     global $tpl;
     $test_file = APP_DIR . "/client/test.php";
     $code = '';
     if (file_exists($test_file)) {
         $code = highlight_file($test_file, true);
     }
     $tpl->assign('code', $code);
 }
开发者ID:AlvarodelRosal,项目名称:xppass,代码行数:10,代码来源:index.class.php


示例17: viewSource

 public function viewSource()
 {
     if (!is_readable($this->source)) {
         return "<h1>File {$this->source} not found.</h1>";
     }
     ob_start();
     highlight_file($this->source);
     $output = ob_get_clean();
     return $output;
 }
开发者ID:JosephineCoder,项目名称:php_examples,代码行数:10,代码来源:Source.php


示例18: showException

 public static function showException($e)
 {
     //Oraculum::Load('Logs');
     $filecode = NULL;
     $message = $e->getMessage();
     $code = $e->getCode();
     $file = $e->getFile();
     $line = $e->getLine();
     $trace = $e->getTrace();
     $traceasstring = $e->getTraceAsString();
     $report = '<h1>' . $message . '</h1>';
     $report .= '<strong>Error Code:</strong> #' . $code . '<br />';
     $report .= '<strong>Source File:</strong> ' . $file . ' <strong>line ' . $line . '</strong><br />';
     $report .= '<h3>Backtrace</h3>';
     foreach ($trace as $error) {
         if (isset($error['file'])) {
             $filecode = $error['file'];
             $report .= '<hr />';
             $report .= '<strong>File:</strong> ' . $filecode . ' <strong>line ' . $error['line'] . '</strong><br />';
         } else {
             $filecode = NULL;
         }
         $args = array();
         if ($error['args']) {
             foreach ($error['args'] as $arg) {
                 if (is_object($arg)) {
                     $args[] = get_class($arg) . ' object';
                 } elseif (is_array($arg)) {
                     $args[] = implode(',', $arg);
                 } else {
                     $args[] = (string) $arg;
                 }
             }
         }
         if (isset($error['class'])) {
             $report .= '<span style="color:#0a0;">' . $error['class'] . '</span>';
         }
         if (isset($error['type'])) {
             $report .= '<font style="color:#000;">' . $error['type'] . '</font>';
         }
         $report .= '<strong style="color:#00a;">' . $error['function'] . '</strong>';
         $report .= '(<font style="color:#a00;">\'' . implode(', ', $args) . '\'</font>);';
         if (!is_null($filecode)) {
             if (file_exists($filecode)) {
                 $cod = 'sourcecodedebug' . time() . rand();
                 $report .= '<br /><a href="#alert"' . $cod . '" onclick="document.getElementById(\'' . $cod . '\').style.display=\'block\';" style="color:#00a;">';
                 $report .= 'Show Source Code</a>';
                 $report .= '<div id="' . $cod . '" style="display:none;border:1px solid #444;background-color:#fff; word-wrap:break-word;">' . highlight_file($filecode, true) . '</div><br />';
             }
         }
     }
     $report = '<div style=\'float:left;text-align:left;\'>' . $report . '</div>';
     //echo $report;
     Logs::alert($report);
 }
开发者ID:phpon,项目名称:on,代码行数:55,代码来源:Exception.php


示例19: generateInner

 public function generateInner()
 {
     if ($this->isSource) {
         $content = highlight_file($this->path, true);
         $t[] = new MDiv('', $this->path, '');
         $t[] = new MDiv('', $content, 'mFileContent');
         $this->inner = $t;
     } else {
         parent::generateInner();
     }
 }
开发者ID:joshuacoddingyou,项目名称:php,代码行数:11,代码来源:mfilecontent.php


示例20: infoAction

 public function infoAction()
 {
     $className = $this->_getParam('class');
     $migration = new $className();
     $this->view->class_name = $className;
     $reflector = new ReflectionClass($className);
     $file = $reflector->getFileName();
     $this->view->file = $file;
     $this->view->source = highlight_file($file, true);
     $this->view->comment = $migration->getComment();
 }
开发者ID:kytvi2p,项目名称:ZettaFramework,代码行数:11,代码来源:AdminController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP highlight_string函数代码示例发布时间:2022-05-15
下一篇:
PHP highlight_code函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap