<?php
setcookie("name", "Alex Porter", time()+3600);
?>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<body>
<!--<?php echo $_COOKIE["name"];?>-->
<script type="text/javascript">
function getCookie(name)
{
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
if(arr != null) return unescape(arr[2]);
return null;
}
if(!getCookie("name"))
{
alert('失败');
}else{
alert(getCookie("name"));
}
</script>
</body>
</html>