1,318 total views, 1 views today
首先在管理區->元件->Jumi->Jumi Applications Manager 裡面新增一個Jumi Application
在Pathname: 為自訂的 php 路徑,在這邊以onlineorder.php 為例。
<?php defined('_JEXEC') OR defined('_VALID_MOS') OR die( "Direct Access Is Not Allowed" ); $somename = JRequest::getVar('somename', '沒有傳入 $_GET[\'somename\']', 'get'); echo $somename; ?>
- 當使用瀏覽器,在網址列輸入
http://localhost/onlineorder.html
畫面將出現
2. 當使用瀏覽器,在網址列輸入
http://localhost/onlineorder.html?somename=20121220
畫面將出現
代表已經成功接收$_GET變數了,或許眼尖的觀眾一定會想說直接用$_GET接不是最快嗎?其實秘密就藏在 JRequest::getVar 函數中,這個是Joomla核心的函數,主要是過濾變數增強安全性,預防SQL injection的。
You can access the filtered request data using the
JRequest
class. Even though PHP allows you to access the data from the request using the superglobal arrays$_GET
,$_POST
and$_REQUEST
, it is highly recommended to useJRequest
instead of these superglobals. By usingJRequest
properly, you make sure that the data has the right format and its default value makes sense. This can prevent serious security holes such as SQL injection vulnerabilities.