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


PHP highlight_file函数代码示例

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


在下文中一共展示了highlight_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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']  =  'philipp@criegern.com';
 * Template: Please Contact Webmaster: {config:"webmaster"}
 * Result:   Please Contact Webmaster: philipp@criegern.com
 *
 * @author Philipp v. Criegern philipp@criegern.com
 */
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


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