即使我将其设置为删除,cookie也会继续回来

Ok i use this code to set cookies

setcookie("search", "active", time()+3600);

and i use this to delete cookies

setcookie("search", "active", time()-3600);

and i use this to check and retrieve cookies

<?
  if (isset($_COOKIE["search"]))
  {
      if ($_COOKIE["search"] === "active")
      {
          echo "cookies active"."<br/>";
          echo $_COOKIE["search"];
      }
      else
      {
          echo "cookies is not active";
      }
  }
  else
  {
      echo "no cookies";
  }
?>

but the set cookies is keep coming back again and again even if i deleted it using the method the i specify above when i refresh the page.

Am not sure why you get this error but have seen this before

Example : Calling

setcookie ( "user", "Alex Porter", time () + 3600 );
setcookie ( "search", "active", time () + 3600 );

var_dump($_COOKIE);

setcookie ( "search", "", time () - 3600 );

Only Outputs

array(1) {
    ["user"]=>
    string(11) "Alex Porter"
}

Expected Result

array(2) {
    ["user"]=>
    string(11) "Alex Porter"
    ["search"]=>
    string(6) "active"
}

Conclusion

I think you would stick to only one cookie or just remove all the cookies at once

Try

Note* Make sure setcookie is always on top of the page and no output is before it

setcookie ( "search", "active", time () + 3600 );  
//setcookie ( "search", "", time () - 3600 );  // uncomment when you want to remove cookie
if (isset ( $_COOKIE ["search"] )) {
    if ($_COOKIE ["search"] === "active") {
        echo "cookies active" . "<br/>";
        echo $_COOKIE ["search"];
    } else {
        echo "cookies is not active";
    }
} else {
    echo "no cookies";
}

Deleting a cookie in PHP does not affect the $_COOKIE super global, as this array is populated before your script runs. It should however no longer be present in $_COOKIE when you load the next page.