html_options 함수

이 함수는 어떤 요소가 선택되는지 지정할 수 있습니다. 값과 출력 속성을 지정하거나 옵션 대안을 지정해야 합니다.

주어진 값이 배열인 경우 OPTGROUP으로 처리됩니다. 재귀가 지원됩니다. 모든 출력은 XHTML 호환과 일치합니다.

선택적 속성 이름이 지정되면 옵션 목록이 "가 올바른 방식으로 표시됩니다. 선택적 속성 이름이 지정되지 않은 경우 이러한 매개변수는 무시됩니다.

test.php:

require('Smarty.class.php');$smarty = new Smarty;

$smarty->ass( 'cust_ids', array(1000,1001,1002,1003));

$smarty->할당('cust_names', array('Joe Schmoe','Jack Smith','JaneJohnson','Carlie Brown' ));$smarty->할당('customer_id', 1001);

$smarty->display('test.html');


test.html:




<이름 선택= customer_id>
{html_options 값=$cust_ids 선택됨=$customer_id 출력=$cust_names}



eg2:

test.php:
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->ass('cust_options', array(
1001 => 'Joe Schmoe' ,
1002 => '잭 스미스',
1003 => '제인 존슨',
1004 => '찰리 브라운'));
$smarty->sign('customer_id', 1001);
$ smarty->display('test.html');

test.html:
<이름 선택=customer_id>
{html_options options=$cust_options selected=$customer_id}



输출:

微信图片_20180313114508.png

지속적인 학습
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!