【发布时间】:2019-11-20 07:05:15
【问题描述】:
我如何获得 ISSET 搜索,例如通过添加 id 和 weight,或使用 JSON 仅添加 id?
例如 example.php?tag=id=3343&weight=alot
<?php
header('Content-Type: application/json');
$tags= array();
$data = (object) [];
$data->id= "3343";
$data->weight= "alot";
$data->year= 42;
array_push( $data);
if( isset( $_GET['tag'])){
echo json_encode($tags);
}
?>
【问题讨论】:
-
你想通过检查来遍历所有的 URL 参数键吗?
-
如果可以列出所有 42 岁以上且重量很大的物品,或者只提供一个参数,如果这有意义的话。