尊龙凯时人生就是搏

thinkphp fetchÒªÁìÔõôÓÃ

Fetch method in ThinkPHP framework is a rendering method that is primarily used to load view pages and render them. ¡£Ê×ÏÈÒªÕÒµ½ThinkPHP¿ò¼ÜÖеÄViewÀ࣬ÓÉÓÚÕâ¸öÒªÁìÊÇÔÚ¸ÃÀàÖнç˵µÄ ¡£

ViewÀàÔÚThinkPHP¿ò¼ÜÖеÄ·¾¶ÈçÏ£º

thinkphp/library/think/View.php

µÇ¼ºó¸´ÖÆ

ÎÒÃÇ¿ÉÒÔͨ¹ýÕâ¸ö·¾¶ÕÒµ½ViewÀàËùÔÚµÄÔ´´úÂëÎļþ ¡£ÔÚView.phpÔ´ÎļþÖУ¬ÓÐÒ»¸öViewÀ࣬ÆäÖнç˵ÁËfetch()ÒªÁìµÄ´úÂ룬ÈçÏÂËùʾ£º

/**
 * äÖȾģ°åÊä³ö
 * @access public
 * @param string    $templateFile Ä£°åÎļþÃû
 * @param array     $vars         Ä£°åÊä³ö±äÁ¿
 * @param array     $config       Ä£°å²ÎÊý
 * @return void
 * @throws Exception
 */
public function fetch($templateFile = '', $vars = [], $config = [])
{
    // ½«±äÁ¿¸³Öµµ½ÊÓͼģ°åÖÐ
    if (!empty($vars)) {
        $this->assign($vars);
    }

    // ´¦ÀíÄ£°åÎļþÃû²¢ÅжÏÊÇ·ñ±£´æ
    $templateFile = $this->parseTemplateFile($templateFile);

    if (!is_file($templateFile)) {
        throw new Exception('template file not exists:' . $templateFile);
    }

    // Ä£°åÊä³ö¹ýÂË
    $this->filter($templateFile);

    // ÆÊÎöÊÓͼģ°åÖеĺ¯Êý
    $content = $this->fetchParse($templateFile, $config);

    // ÊÓͼģ°å±àÒ뻺´æ
    if ($this->config('tpl_cache') && !empty($TemplateCache)) {
        $TemplateCache->set($cacheFile, $content);
    }

    // ·µ»ØÆÊÎöºóµÄÊÓͼģ°åÄÚÈÝ
    return $content;
}

µÇ¼ºó¸´ÖÆ

ÔÚÕâ¶Î´úÂëÖУ¬ÎÒÃÇ¿ÉÒÔ¿´µ½fetchÒªÁìµÄ½ç˵ºÍÏêϸʵÏÖ ¡£

Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»

ÔÚfetchÒªÁìÖУ¬ÎÒÃÇÊ×ÏÈʹÓÃassignÒªÁìת´ïÄ£°å±äÁ¿ºÍÒªäÖȾµÄÄ£°åÎļþÃû£¬ÒÔ¾ÙÐбäÁ¿¸³Öµ ¡£½Ó×ÅÅжÏÄ£°åÎļþÊÇ·ñ±£´æ£¬ÈôÊDz»±£´æÔòÅ׳öÒì³£ ¡£×îºó£¬¾ÙÐÐÊÓͼģ°åÊä³ö¹ýÂË£¬ÆÊÎöÊÓͼģ°åÖеĺ¯Êý²¢·µ»Ø´¦ÀíºóµÄÄÚÈÝ ¡£

ÒÔÉϾÍÊÇthinkphp fetchÒªÁìÔõôÓõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是搏ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼ ¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是搏ʵʱÐÞÕý»òɾ³ý ¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ