尝试是否有$ _GET值

时间:2019-02-19 13:23:38

标签: php

有一种方法可以确定在GET请求中是否传递了$ _GET值(不带有特定键)?我不确定语法

<script src="https://cdn.jsdelivr.net/gh/cferdinandi/smooth-scroll@14.0.0/dist/smooth-scroll.polyfills.min.js"></script>

<a data-scroll href="#bazinga">Click here</a>
<div>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>
<div>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>
<div id="bazinga">Bazinga!</div>

<script>
	var scroll = new SmoothScroll('a[href*="#"]', {
    speed: 500,
	  speedAsDuration: true
  });
</script>

有效

1 个答案:

答案 0 :(得分:2)

$_GET是数组,因此请使用count而不是isset

<?php
  if(count($_GET) >0){
   //valid
 }
?>