PHP_MySQL创新.ppt
文本预览下载声明
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 然而有时php也是区分大小写的。就是在客户端表单提交时,字段名中如含有大写字母,那么在服务器端的$_GET,$_POST全局变量的名称必须注意大小写。 * * * * * * * * * * * * * Smarty样版-变量 一、由PHP指派变量给样版(变量、数组、对象) $smarty-assign(‘firstname ’,’Grace’);//单一变量$smarty-assign(‘Contacts’, ???? array( ‘fax’ = ‘555-222-9876’,???????? ?? ‘email’ = ‘zaphod@’,?????????? ‘phone’ = array(‘home’ = ‘555-444-3333’,???????????? ?????????????? ‘cell’ = ‘555-111-1234’ )));//数组 $smarty-assign(‘myobj’,$conn); //物件 样版中取得方式{$firstname} {*单一变量 *}{$Contacts.fax}{$Contacts.phone.home}{*取得数组以. *}{$Contacts[0]}{$Contacts[2][0]}{*取得数组以[] *} {$myobj-setcolor()}{*取得对象以- *} * Smarty样版-变量 二、从样版中载入config檔 foo.conf: pageTitle = This is mine bodyBgColor = #eeeeee tableBorderSize = 3 tableBgColor = #bbbbbb rowBgColor = #cccccc“ index.tpl: {config_load file=“foo.conf”} html title {#pageTitle#} /title body bgcolor=“{#bodyBgColor#} table border=“{#tableBorderSize#}” bgcolor=“{#tableBgColor#} tr bgcolor=“{#rowBgColor#}” tdFirst/td tdLast/td tdAddress/td /tr /table /body /html> * Smarty样版-变量 三、{$smarty}保留变量(1) {* display value of page from URL (GET) *} {$smarty.get.page} {* display the variable page from a form (POST) *} {$smarty.post.page} {* display the value of the cookie username *} {$smarty.cookies.username} {* display the server variable SERVER_NAME *} {$smarty.server.SERVER_NAME} {* display the php session variable id *} {$smarty.session.id} {* display the variable username from merged get/post/cookies/server/env *} {$smarty.request.username} * Smarty样版-变量 三、{$smarty}保留变量(2) {$smarty.now} {$smarty.const} {$smarty.capture} {$smarty.config} {$smarty.section}, {$smarty.foreach} {$smarty.template} {$smarty.version} {$smarty.ldelim} and
显示全部