首頁 > 後端開發 > php教程 > php 簡單的web get 請求處理

php 簡單的web get 請求處理

WBOY
發布: 2016-07-29 09:04:18
原創
1047 人瀏覽過
<span><span>$output</span><span>= </span><span>array</span><span>();
</span><span>$a </span><span>= @</span><span>$_GET</span><span>[</span><span>'useid'</span><span>] ? </span><span>$_GET</span><span>[</span><span>'useid'</span><span>] : </span><span>''</span><span>;
</span><span><em>//$uid = @$_GET['uid'] ? $_GET['uid'] : 0;
</em></span><span><em></em></span><span>if </span><span>(</span><span>empty</span><span>(</span><span>$a</span><span>)) {
</span><span><em>// $output = array('data'=>NULL, 'info'=>'ios!', 'code'=>-201);
</em></span><span><em></em></span><span>$output</span><span>= </span><span>array</span><span>(</span><span>'hahah'</span><span>=></span><span>'hello'</span><span>,
</span><span>'requestDic'</span><span>=></span><span>'hello'</span><span>,</span><span>'hello'</span><span>=></span><span>array</span><span>(</span><span>'image'</span><span>=></span><span>'www.baidu.com'</span><span>,</span><span>'imageurl'</span><span>=></span><span>'www.baidu.com'</span><span>));
</span><span>exit</span><span>(json_encode(</span><span>$output</span><span>));
</span><span> }</span><span>elseif</span><span>(!</span><span>empty</span><span>(</span><span>$a</span><span>)){
</span><span>$output</span><span>= </span><span>array</span><span>(</span><span>'hahah'</span><span>=></span><span>'hello'</span><span>,
</span><span>'requestDic'</span><span>=></span><span>'hello'</span><span>,</span><span>'hello'</span><span>=></span><span>array</span><span>(</span><span>'image'</span><span>=></span><span>'www.sina.com'</span><span>,</span><span>'imageurl'</span><span>=></span><span>'www.sina.com'</span><span>));
</span><span>exit</span><span>(json_encode(</span><span>$output</span><span>));
</span><span> };</span></span>
登入後複製

以上就介紹了php 簡單的web get 請求處理,包括了方面的內容,希望對PHP教程有興趣的朋友有幫助。

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板