다른 프로그래머의 코드를 읽는 동안 <<<H.TML
기호가 나타납니다. 내 동료는 PHP 파일 내에서 HTML을 작성하는 데 사용되는 것이라고 말했다.이 기호 "<<< HTML"은 무엇을 의미합니까?
사용법에 대한 자세한 정보를 찾으려고했지만 많이 찾지 못했습니다. 아무에게 나에게 그것이 어떻게 작동하고 그것이 무엇이라고 불렀는지 설명해 주시겠습니까? 당신은 당신이 heredoc syntax
구문을 사용할 수 있습니다 PHP 변수에 문자열로 큰 콘텐츠를 사용하고자 할 때
public function SetContent($page = '') {
$this->_header->SetPageNavigation($page) ;
$budgetHTML = '';
$signup1 = '';
$GetHeader = $this->_header->GetHeader() ;
$GetFooter = $this->_footer->GetFooter() ;
$DocType = <<<HTML
<!DOCTYPE html>
<!--[if IE 8]> <html class="no-js ie8 ie" lang="en"> <![endif]-->
<!--[if IE 9]> <html class="no-js ie9 ie" lang="en"> <![endif]-->
<!--[if gt IE 9]><![endif]-->
HTML;
$this->_html = sprintf("{$DocType}<html>");
$this->_html .= sprintf("%s", $this->_head->GetHTML());
$bg=$this->_common->getBgImage();
$bg=json_decode($bg);
if(!empty($bg->BGImage)&&(file_exists($GLOBALS['DocumentRoot'].'/bgImages/'.$bg->BGImage)))
{
$backgroundImage='background: url('.$GLOBALS['DOCUMENT_ROOT'].'/bgImages/'.$bg->BGImage.') no-repeat fixed top center;background-size: cover !important;';
}
else
{
$backgroundImage='';
}
$this->_html .= sprintf('<body style="'.$backgroundImage.'" >
<noscript>
<h1 style="color:red; text-align:center; padding-top:100px;">This page needs JavaScript activated to work</h1>
<style>div { display:none; }</style>
</noscript>
<div class="loading"><img src="'.$GLOBALS['RootURL'].'images/main-loader.GIF" width="128" height="128" ></div>
<div id="wrapper"><div class="page-bg">%s%s%s%s<div class="clear"></div></div></div>', $GetHeader, $budgetHTML, $this->_maincontenthtml, $GetFooter);
$this->_html .= sprintf("</body>");
}
경우이 코드를 발견 했는가? 링크를 공유 할 수있는 오픈 소스 저장소에서 사용할 수 있습니까? – callmekatootie