WordPress里的setcookie()函数如何设置?
总提示这句有问题
setcookie('weixin_fensi', 100086, time(), COOKIEPATH, COOKIE_DOMAIN, false);//30天时间
下面是完整代码function e_secret($atts, $content=null){
if ( !isset($_COOKIE['weixin_fensi']) && isset($_POST['e_secret_key']) && $_POST['e_secret_key']==git_get_option('git_mp_code')) {
setcookie('weixin_fensi', 10086, time(), COOKIEPATH, COOKIE_DOMAIN, false);//30天时间
return '<script type="text/javascript">window.location = document.referrer;</script>';
}
extract(shortcode_atts(array('wx'=>null), $atts));
if( $_COOKIE['weixin_fensi']=='10086' || strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false ){
return '<div class="e-secret"><fieldset><legend>隐藏的内容</legend>
'.$content.'<div class="clear"></div></fieldset></div>';
}else{
if($wx =='1'){
return '<div class="wxbox"><img class="wxpic" src="'.git_get_option('git_mp_qr').'" alt="'.git_get_option('git_mp_name').'" title="'.git_get_option('git_mp_name').'" align="right"><form method="post" name="e-secret"><span class="yzts" style="font-size:18px;">验证码:</span><input name="e_secret_key" id="verifycode" value="" type="text"><input id="verifybtn" name="" value="提交查看" type="submit"></form><div class="wxtips">'.git_get_option('git_mp_tips').'</div><div class="cl"></div></div>';
}else{
return '<form class="e-secret" method="post" name="e-secret"><label>输入密码查看加密内容:</label><input type="password" name="e_secret_key" class="euc-y-i" maxlength="50"><input type="submit" class="euc-y-s" value="确定"><div class="euc-clear"></div></form>';
}
}
}
add_shortcode('secret','e_secret');
问题出在哪里,有人能告知下吗
setcookie('weixin_fensi', 100086, time(), COOKIEPATH, COOKIE_DOMAIN, false);//30天时间
下面是完整代码function e_secret($atts, $content=null){
if ( !isset($_COOKIE['weixin_fensi']) && isset($_POST['e_secret_key']) && $_POST['e_secret_key']==git_get_option('git_mp_code')) {
setcookie('weixin_fensi', 10086, time(), COOKIEPATH, COOKIE_DOMAIN, false);//30天时间
return '<script type="text/javascript">window.location = document.referrer;</script>';
}
extract(shortcode_atts(array('wx'=>null), $atts));
if( $_COOKIE['weixin_fensi']=='10086' || strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false ){
return '<div class="e-secret"><fieldset><legend>隐藏的内容</legend>
'.$content.'<div class="clear"></div></fieldset></div>';
}else{
if($wx =='1'){
return '<div class="wxbox"><img class="wxpic" src="'.git_get_option('git_mp_qr').'" alt="'.git_get_option('git_mp_name').'" title="'.git_get_option('git_mp_name').'" align="right"><form method="post" name="e-secret"><span class="yzts" style="font-size:18px;">验证码:</span><input name="e_secret_key" id="verifycode" value="" type="text"><input id="verifybtn" name="" value="提交查看" type="submit"></form><div class="wxtips">'.git_get_option('git_mp_tips').'</div><div class="cl"></div></div>';
}else{
return '<form class="e-secret" method="post" name="e-secret"><label>输入密码查看加密内容:</label><input type="password" name="e_secret_key" class="euc-y-i" maxlength="50"><input type="submit" class="euc-y-s" value="确定"><div class="euc-clear"></div></form>';
}
}
}
add_shortcode('secret','e_secret');
问题出在哪里,有人能告知下吗
0 个回复