객체를 smarty 태그로 전달할 때 문제가 있습니다.PHP 객체를 멋지게 전달
$contact = new Contacts;
$smarty = new Smarty;
$smarty->assign('contact',$contact);
test.htpl에서 :
<html>
<head>
<title>{$title}</title>
</head>
<body>
id: {$contact->id} <br/>
name: {$contact->name} <br/>
email: {$contact->email} <br/>
phone: {$contact->phone} <br/>
</body>
</html>
이 잘못된 문자의 경고 '>'로 연결 나는 다음과 같은 코드가 있습니다. 이 문제를 어떻게 해결할 수 있습니까? '이 방법은 다음 또한 다음 돈
<html>
<head>
<title>{$title}</title>
</head>
<body>
id: {$contact->id} <br/>
name: {$contact->name} <br/>
email: {$contact->email} <br/>
phone: {$contact->phone} <br/>
</body>
</html>
를 작동해야 그것을 호출
$smarty->register_object('contact',$contact);
를 작동해야 다음을 수행하여
class Contacts
{
public $id = 1;
public $name = 'Mada';
public $email = '[email protected]';
public $phone = 123456;
}
연락처 수업에 우리에게 무엇을 보여줄 수 있습니까? – RJD22
"현명한 템플릿 개체"를 검색하면 http://www.smarty.net/manual/en/advanced.features.php가 첫 번째 결과로 이어집니다. – zneak