Home >Backend Development >PHP Tutorial >PHP simple web get request processing

PHP simple web get request processing

WBOY
WBOYOriginal
2016-07-29 09:04:181049browse
<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>

The above introduces PHP's simple web get request processing, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn