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


PHP ob_start函数代码示例

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


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

示例1: command_dd

 function command_dd()
 {
     $args = func_get_args();
     $options = $this->get_options();
     $dd = kernel::single('dev_docbuilder_dd');
     if (empty($args)) {
         $dd->export();
     } else {
         foreach ($args as $app_id) {
             $dd->export_tables($app_id);
         }
     }
     if ($filename = $options['result-file']) {
         ob_start();
         $dd->output();
         $out = ob_get_contents();
         ob_end_clean();
         if (!is_dir(dirname($filename))) {
             throw new Exception('cannot find the ' . dirname($filename) . 'directory');
         } elseif (is_dir($filename)) {
             throw new Exception('the result-file path is a directory.');
         }
         file_put_contents($options['result-file'], $out);
         echo 'data dictionary doc export success.';
     } else {
         $dd->output();
     }
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:28,代码来源:doc.php

示例2: dump

function dump($var, $echo = true, $label = null, $strict = true)
{
    $label = $label === null ? '' : rtrim($label) . ' ';
    if (!$strict) {
        if (ini_get('html_errors')) {
            $output = print_r($var, true);
            $output = "<pre>" . $label . htmlspecialchars($output, ENT_QUOTES) . "</pre>";
        } else {
            $output = $label . " : " . print_r($var, true);
        }
    } else {
        ob_start();
        var_dump($var);
        $output = ob_get_clean();
        if (!extension_loaded('xdebug')) {
            $output = preg_replace("/\\]\\=\\>\n(\\s+)/m", "] => ", $output);
            $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES, "GB2312") . '</pre>';
        }
    }
    if ($echo) {
        echo $output;
        return null;
    } else {
        return $output;
    }
}
开发者ID:winiceo,项目名称:job,代码行数:26,代码来源:lib.php

示例3: testAuth

 /**
  * Test for AuthenticationSignon::auth
  *
  * @return void
  */
 public function testAuth()
 {
     if (!defined('PMA_TEST_HEADERS')) {
         $this->markTestSkipped('Cannot redefine constant/function - missing runkit extension');
     }
     // case 1
     $GLOBALS['cfg']['Server']['SignonURL'] = '';
     ob_start();
     $this->object->auth();
     $result = ob_get_clean();
     $this->assertContains('You must set SignonURL!', $result);
     // case 2
     $GLOBALS['cfg']['Server']['SignonURL'] = 'http://phpmyadmin.net/SignonURL';
     $_REQUEST['old_usr'] = 'oldUser';
     $GLOBALS['cfg']['Server']['LogoutURL'] = 'http://phpmyadmin.net/logoutURL';
     $this->object->auth();
     $this->assertContains('Location: http://phpmyadmin.net/logoutURL?PHPSESSID=', $GLOBALS['header'][0]);
     // case 3
     $GLOBALS['header'] = array();
     $GLOBALS['cfg']['Server']['SignonURL'] = 'http://phpmyadmin.net/SignonURL';
     $_REQUEST['old_usr'] = '';
     $GLOBALS['cfg']['Server']['LogoutURL'] = '';
     $this->object->auth();
     $this->assertContains('Location: http://phpmyadmin.net/SignonURL?PHPSESSID=', $GLOBALS['header'][0]);
 }
开发者ID:roccivic,项目名称:phpmyadmin,代码行数:30,代码来源:PMA_AuthenticationSignon_test.php

示例4: smarty_core_display_debug_console

/**
 * Smarty debug_console function plugin
 *
 * Type:     core<br>
 * Name:     display_debug_console<br>
 * Purpose:  display the javascript debug console window
 * @param array Format: null
 * @param Smarty
 */
function smarty_core_display_debug_console($params, &$smarty)
{
    // we must force compile the debug template in case the environment
    // changed between separate applications.
    if (empty($smarty->debug_tpl)) {
        // set path to debug template from SMARTY_DIR
        $smarty->debug_tpl = SMARTY_DIR . 'debug.tpl';
        if ($smarty->security && is_file($smarty->debug_tpl)) {
            $smarty->secure_dir[] = realpath($smarty->debug_tpl);
        }
        $smarty->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl';
    }
    $_ldelim_orig = $smarty->left_delimiter;
    $_rdelim_orig = $smarty->right_delimiter;
    $smarty->left_delimiter = '{';
    $smarty->right_delimiter = '}';
    $_compile_id_orig = $smarty->_compile_id;
    $smarty->_compile_id = null;
    $_compile_path = $smarty->_get_compile_path($smarty->debug_tpl);
    if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path)) {
        ob_start();
        $smarty->_include($_compile_path);
        $_results = ob_get_contents();
        ob_end_clean();
    } else {
        $_results = '';
    }
    $smarty->_compile_id = $_compile_id_orig;
    $smarty->left_delimiter = $_ldelim_orig;
    $smarty->right_delimiter = $_rdelim_orig;
    return $_results;
}
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:41,代码来源:core.display_debug_console.php

示例5: doDisplay

 protected function doDisplay(array $context, array $blocks = array())
 {
     $__internal_7088dc18de042b162a99a327c85232e1f7c79938f5c6e62a2f20a47464d52c5f = $this->env->getExtension("native_profiler");
     $__internal_7088dc18de042b162a99a327c85232e1f7c79938f5c6e62a2f20a47464d52c5f->enter($__internal_7088dc18de042b162a99a327c85232e1f7c79938f5c6e62a2f20a47464d52c5f_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "WebProfilerBundle:Profiler:toolbar_item.html.twig"));
     // line 1
     if (isset($context["link"]) ? $context["link"] : $this->getContext($context, "link")) {
         // line 2
         echo "    ";
         ob_start();
         // line 3
         echo "        <a href=\"";
         echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("_profiler", array("token" => isset($context["token"]) ? $context["token"] : $this->getContext($context, "token"), "panel" => isset($context["name"]) ? $context["name"] : $this->getContext($context, "name"))), "html", null, true);
         echo "\">";
         echo twig_escape_filter($this->env, isset($context["icon"]) ? $context["icon"] : $this->getContext($context, "icon"), "html", null, true);
         echo "</a>\n    ";
         $context["icon"] = '' === ($tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
     }
     // line 6
     echo "<div class=\"sf-toolbar-block\">\n     <div class=\"sf-toolbar-icon\">";
     // line 7
     echo twig_escape_filter($this->env, array_key_exists("icon", $context) ? _twig_default_filter(isset($context["icon"]) ? $context["icon"] : $this->getContext($context, "icon"), "") : "", "html", null, true);
     echo "</div>\n     <div class=\"sf-toolbar-info\">";
     // line 8
     echo twig_escape_filter($this->env, array_key_exists("text", $context) ? _twig_default_filter(isset($context["text"]) ? $context["text"] : $this->getContext($context, "text"), "") : "", "html", null, true);
     echo "</div>\n</div>\n";
     $__internal_7088dc18de042b162a99a327c85232e1f7c79938f5c6e62a2f20a47464d52c5f->leave($__internal_7088dc18de042b162a99a327c85232e1f7c79938f5c6e62a2f20a47464d52c5f_prof);
 }
开发者ID:valeriemontoya90,项目名称:findWorker,代码行数:27,代码来源:8d4635b47ab8ab3bf3352cb81a02e822f23088a5da0711f03c5ad81c103fe122.php

示例6: __construct

 /**
  * Constructor
  *
  * @access	public
  * @param	object		ipsRegistry reference
  * @param	array 		Configuration info for this method
  * @param	array 		Custom configuration info for this method
  * @return	void
  */
 public function __construct(ipsRegistry $registry, $method, $conf = array())
 {
     $this->method_config = $method;
     $this->openid_config = $conf;
     parent::__construct($registry);
     //-----------------------------------------
     // Fix include path for OpenID libs
     //-----------------------------------------
     $path_extra = dirname(__FILE__);
     $path = ini_get('include_path');
     $path = $path_extra . PATH_SEPARATOR . $path;
     ini_set('include_path', $path);
     define('Auth_OpenID_RAND_SOURCE', null);
     //-----------------------------------------
     // OpenID libraries are not STRICT compliant
     //-----------------------------------------
     ob_start();
     /**
      * Turn off strict error reporting for openid
      */
     if (version_compare(PHP_VERSION, '5.2.0', '>=')) {
         error_reporting(E_ERROR | E_WARNING | E_PARSE | E_RECOVERABLE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_USER_WARNING);
     } else {
         error_reporting(E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR | E_USER_ERROR | E_USER_WARNING);
     }
     //-----------------------------------------
     // And grab libs
     //-----------------------------------------
     require_once "Auth/OpenID/Consumer.php";
     require_once "Auth/OpenID/FileStore.php";
     require_once "Auth/OpenID/SReg.php";
     require_once "Auth/OpenID/PAPE.php";
 }
开发者ID:dalandis,项目名称:Visualization-of-Cell-Phone-Locations,代码行数:42,代码来源:auth.php

示例7: pc_tag

 /**
  * PC标签中调用数据
  * @param array $data 配置数据
  */
 public function pc_tag($data)
 {
     $siteid = isset($data['siteid']) && intval($data['siteid']) ? intval($data['siteid']) : get_siteid();
     $r = $this->db->select(array('pos' => $data['pos'], 'siteid' => $siteid));
     $str = '';
     if (!empty($r) && is_array($r)) {
         foreach ($r as $v) {
             if (defined('IN_ADMIN') && !defined('HTML')) {
                 $str .= '<div id="block_id_' . $v['id'] . '" class="admin_block" blockid="' . $v['id'] . '">';
             }
             if ($v['type'] == '2') {
                 extract($v, EXTR_OVERWRITE);
                 $data = string2array($data);
                 if (!defined('HTML')) {
                     ob_start();
                     include $this->template_url($id);
                     $str .= ob_get_contents();
                     ob_clean();
                 } else {
                     include $this->template_url($id);
                 }
             } else {
                 $str .= $v['data'];
             }
             if (defined('IN_ADMIN') && !defined('HTML')) {
                 $str .= '</div>';
             }
         }
     }
     return $str;
 }
开发者ID:klj123wan,项目名称:czsz,代码行数:35,代码来源:block_tag.class.php

示例8: setup_wizard

 /**
  * Show the setup wizard
  */
 public function setup_wizard()
 {
     if (empty($_GET['page']) || 'wc-setup' !== $_GET['page']) {
         return;
     }
     $this->steps = array('introduction' => array('name' => __('Introduction', 'woocommerce'), 'view' => array($this, 'wc_setup_introduction'), 'handler' => ''), 'pages' => array('name' => __('Page Setup', 'woocommerce'), 'view' => array($this, 'wc_setup_pages'), 'handler' => array($this, 'wc_setup_pages_save')), 'locale' => array('name' => __('Store Locale', 'woocommerce'), 'view' => array($this, 'wc_setup_locale'), 'handler' => array($this, 'wc_setup_locale_save')), 'shipping_taxes' => array('name' => __('Shipping &amp; Tax', 'woocommerce'), 'view' => array($this, 'wc_setup_shipping_taxes'), 'handler' => array($this, 'wc_setup_shipping_taxes_save')), 'payments' => array('name' => __('Payments', 'woocommerce'), 'view' => array($this, 'wc_setup_payments'), 'handler' => array($this, 'wc_setup_payments_save')), 'next_steps' => array('name' => __('Ready!', 'woocommerce'), 'view' => array($this, 'wc_setup_ready'), 'handler' => ''));
     $this->step = isset($_GET['step']) ? sanitize_key($_GET['step']) : current(array_keys($this->steps));
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     wp_register_script('select2', WC()->plugin_url() . '/assets/js/select2/select2' . $suffix . '.js', array('jquery'), '3.5.2');
     wp_register_script('wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array('jquery', 'select2'), WC_VERSION);
     wp_localize_script('wc-enhanced-select', 'wc_enhanced_select_params', array('i18n_matches_1' => _x('One result is available, press enter to select it.', 'enhanced select', 'woocommerce'), 'i18n_matches_n' => _x('%qty% results are available, use up and down arrow keys to navigate.', 'enhanced select', 'woocommerce'), 'i18n_no_matches' => _x('No matches found', 'enhanced select', 'woocommerce'), 'i18n_ajax_error' => _x('Loading failed', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_1' => _x('Please enter 1 or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_n' => _x('Please enter %qty% or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_1' => _x('Please delete 1 character', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_n' => _x('Please delete %qty% characters', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_n' => _x('You can only select %qty% items', 'enhanced select', 'woocommerce'), 'i18n_load_more' => _x('Loading more results&hellip;', 'enhanced select', 'woocommerce'), 'i18n_searching' => _x('Searching&hellip;', 'enhanced select', 'woocommerce'), 'ajax_url' => admin_url('admin-ajax.php'), 'search_products_nonce' => wp_create_nonce('search-products'), 'search_customers_nonce' => wp_create_nonce('search-customers')));
     wp_enqueue_style('woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), WC_VERSION);
     wp_enqueue_style('wc-setup', WC()->plugin_url() . '/assets/css/wc-setup.css', array('dashicons', 'install'), WC_VERSION);
     wp_register_script('wc-setup', WC()->plugin_url() . '/assets/js/admin/wc-setup.min.js', array('jquery', 'wc-enhanced-select'), WC_VERSION);
     wp_localize_script('wc-setup', 'wc_setup_params', array('locale_info' => json_encode(include WC()->plugin_path() . '/i18n/locale-info.php')));
     if (!empty($_POST['save_step']) && isset($this->steps[$this->step]['handler'])) {
         call_user_func($this->steps[$this->step]['handler']);
     }
     ob_start();
     $this->setup_wizard_header();
     $this->setup_wizard_steps();
     $this->setup_wizard_content();
     $this->setup_wizard_footer();
     exit;
 }
开发者ID:zengskie,项目名称:Heroku-WordPress-PostgreSQL,代码行数:28,代码来源:class-wc-admin-setup-wizard.php

示例9: render

 public function render($template = null, array $arguments = null)
 {
     if (null === $template) {
         return false;
     }
     $parentTemplate = $this->currentTemplate;
     $this->currentTemplate = $this->totalTemplates = $this->totalTemplates + 1;
     $path = $this->finder->getPath($template);
     if (!is_file($path)) {
         throw new \RuntimeException('The requested view file doesn\'t exist in: <strong>' . $path . '</strong>', 404);
     }
     ob_start();
     try {
         $this->requireInContext($path, $arguments);
     } catch (\Exception $e) {
         ob_end_clean();
         throw $e;
     }
     if (isset($this->parent[$this->currentTemplate])) {
         $this->data['content'] = ob_get_contents();
         ob_end_clean();
         $this->render($this->parent[$this->currentTemplate], $arguments);
     } else {
         ob_end_flush();
     }
     if ($parentTemplate == 0) {
         $this->clean();
     } else {
         $this->currentTemplate = $parentTemplate;
     }
 }
开发者ID:hecrj,项目名称:sea_core,代码行数:31,代码来源:Engine.php

示例10: pageStart

 function pageStart()
 {
     if (0 == $this->_bObStarted) {
         ob_start();
         $this->_bObStarted = 1;
     }
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:7,代码来源:BxDolModuleTemplate.php

示例11: popular

function popular($skin_dir = 'basic', $pop_cnt = 7, $date_cnt = 3)
{
    global $config, $g5;
    if (!$skin_dir) {
        $skin_dir = 'basic';
    }
    $date_gap = date("Y-m-d", G5_SERVER_TIME - $date_cnt * 86400);
    $sql = " select pp_word, count(*) as cnt from {$g5['popular_table']} where pp_date between '{$date_gap}' and '" . G5_TIME_YMD . "' group by pp_word order by cnt desc, pp_word limit 0, {$pop_cnt} ";
    $result = sql_query($sql);
    for ($i = 0; $row = sql_fetch_array($result); $i++) {
        $list[$i] = $row;
        // 스크립트등의 실행금지
        $list[$i]['pp_word'] = get_text($list[$i]['pp_word']);
    }
    ob_start();
    if (G5_IS_MOBILE) {
        $popular_skin_path = G5_MOBILE_PATH . '/' . G5_SKIN_DIR . '/popular/' . $skin_dir;
        $popular_skin_url = G5_MOBILE_URL . '/' . G5_SKIN_DIR . '/popular/' . $skin_dir;
    } else {
        $popular_skin_path = G5_SKIN_PATH . '/popular/' . $skin_dir;
        $popular_skin_url = G5_SKIN_URL . '/popular/' . $skin_dir;
    }
    include_once $popular_skin_path . '/popular.skin.php';
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
开发者ID:ned3y2k,项目名称:youngcart5,代码行数:27,代码来源:popular.lib.php

示例12: render

 public function render()
 {
     extract($this->pageVars);
     ob_start();
     require $this->template;
     echo ob_get_clean();
 }
开发者ID:rogerioalbino,项目名称:mvc,代码行数:7,代码来源:AbstractView.php

示例13: doDisplay

 protected function doDisplay(array $context, array $blocks = array())
 {
     $__internal_f6fbb0d538f0cf945a7cc2537fcd6ea50556067234df0d59685d58ab6cd80c70 = $this->env->getExtension("native_profiler");
     $__internal_f6fbb0d538f0cf945a7cc2537fcd6ea50556067234df0d59685d58ab6cd80c70->enter($__internal_f6fbb0d538f0cf945a7cc2537fcd6ea50556067234df0d59685d58ab6cd80c70_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "@WebProfiler/Profiler/toolbar_item.html.twig"));
     // line 1
     if (isset($context["link"]) ? $context["link"] : $this->getContext($context, "link")) {
         // line 2
         echo "    ";
         ob_start();
         // line 3
         echo "        <a href=\"";
         echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("_profiler", array("token" => isset($context["token"]) ? $context["token"] : $this->getContext($context, "token"), "panel" => isset($context["name"]) ? $context["name"] : $this->getContext($context, "name"))), "html", null, true);
         echo "\">";
         echo twig_escape_filter($this->env, isset($context["icon"]) ? $context["icon"] : $this->getContext($context, "icon"), "html", null, true);
         echo "</a>\n    ";
         $context["icon"] = '' === ($tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
     }
     // line 6
     echo "<div class=\"sf-toolbar-block\">\n     <div class=\"sf-toolbar-icon\">";
     // line 7
     echo twig_escape_filter($this->env, array_key_exists("icon", $context) ? _twig_default_filter(isset($context["icon"]) ? $context["icon"] : $this->getContext($context, "icon"), "") : "", "html", null, true);
     echo "</div>\n     <div class=\"sf-toolbar-info\">";
     // line 8
     echo twig_escape_filter($this->env, array_key_exists("text", $context) ? _twig_default_filter(isset($context["text"]) ? $context["text"] : $this->getContext($context, "text"), "") : "", "html", null, true);
     echo "</div>\n</div>\n";
     $__internal_f6fbb0d538f0cf945a7cc2537fcd6ea50556067234df0d59685d58ab6cd80c70->leave($__internal_f6fbb0d538f0cf945a7cc2537fcd6ea50556067234df0d59685d58ab6cd80c70_prof);
 }
开发者ID:NotBadCode,项目名称:FinanceTest,代码行数:27,代码来源:02d42ef81b938fabb9028e93c7663e4c7dcdca2fdae35e978661f8a8aa0ccd29.php

示例14: _format

 private function _format($id, $data, $type)
 {
     switch ($type) {
         case '1':
             // json
             if (CHARSET == 'gbk') {
                 $data = array_iconv($data, 'gbk', 'utf-8');
             }
             return json_encode($data);
             break;
         case '2':
             // xml
             $xml = Loader::lib('Xml');
             return $xml->xml_serialize($data);
             break;
         case '3':
             // js
             Loader::func('dbsource:global');
             ob_start();
             include template_url($id);
             $html = ob_get_contents();
             ob_clean();
             return format_js($html);
             break;
     }
 }
开发者ID:hubs,项目名称:yuncms,代码行数:26,代码来源:CallController.php

示例15: b_wp_archives_monthly_show

 function b_wp_archives_monthly_show($options, $wp_num = "")
 {
     $block_style = $options[0] ? $options[0] : 0;
     $with_count = $options[1] == 0 ? false : true;
     global $wpdb, $siteurl, $wp_id, $wp_inblock, $use_cache;
     $id = 1;
     $use_cache = 1;
     if ($wp_num == "") {
         $wp_id = $wp_num;
         $wp_inblock = 1;
         require dirname(__FILE__) . '/../wp-config.php';
         $wp_inblock = 0;
     }
     ob_start();
     if ($block_style == 0) {
         // Simple Listing
         get_archives('monthly', '', 'html', '', '', $with_count);
     } else {
         // Dropdown Listing
         echo '<form name="archiveform' . $wp_num . '" action="">';
         echo '<select name="archive_chrono" onchange="window.location = (document.forms.archiveform' . $wp_num . '.archive_chrono[document.forms.archiveform' . $wp_num . '.archive_chrono.selectedIndex].value);"> ';
         echo '<option value="">' . _WP_BY_MONTHLY . '</option>';
         get_archives('monthly', '', 'option', '', '', $with_count);
         echo '</select>';
         echo '</form>';
     }
     $block['content'] = ob_get_contents();
     ob_end_clean();
     return $block;
 }
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:30,代码来源:wp_archives_monthly.php


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