嘿你们我在这里有这个网站http://www.taranmarlowjewelry.com/,并在右上角有一个购物车,但它并没有显示当你第一次访问该网站,但当你刷新页面它显示向上。WordPress的phpinfo饼干问题
我一直在研究这一点,我认为它与这个Cookie PHPSESSID有关,因为当我删除该cookie时,购物车又会消失。
我也被告知这是一个PHP配置问题。
我试图做一些调整,我像这样php5.ini文件...
session.use_only_cookies = 1
session.use_trans_sid = 0
session.url_rewriter.tags = ""
,但没有工作....我是从这里http://wordpress.org/support/topic/frontpage-slideshow-and-phpsessid-in-general-fix?replies=1
有谁知道这是我需要调整我的PHP配置?
我试图设置的wp-content /主题/ twentyeleven/header.php文件cookie中这样的标记之后...
<?php
setcookie("PHPSESSID","6a52e6037be6342014834c475b6c0637","/","http://www.taranmarlowjewelry.com/")
?>
,然后我得到这个错误..
Warning: setcookie() expects parameter 3 to be long, string given in /home/content/19/9468119/html/wp-content/themes/twentyeleven/header.php on line 54
当您第一次访问我的网站时,购物车并未显示,但当您刷新它时仍会显示。
我甚至手动将在cookie中我的主题的functions.php文件在像这样的底部...
function set_new_cookie() {
setcookie("PHPSESSID", '6a52e6037be6342014834c475b6c0637', time()+3600); /* expire in 1 hour */
}
add_action('init', 'set_new_cookie');
它集,它不显示任何错误,但它并没有解决我的问题。
我也试过这在我的主题的functions.php文件...
function set_new_cookie() {
set_cookie('PHPSESSID', '6a52e6037be6342014834c475b6c0637');
$_COOKIE['PHPSESSID'] = '6a52e6037be6342014834c475b6c0637';
}
add_action('init', 'set_new_cookie');
,并得到这个错误
Fatal error: Call to undefined function set_cookie() in /home/content/19/9468119/html/wp-content/themes/twentyeleven/functions.php on line 5
这里是购物车的形式...
<form class="product_search" style="font-size:0px !important;" method="GET" action="<?php echo $pp_url?>/" >
<input name="product_search" id="wpsc_search_autocomplete" class="wpsc_product_search wpsc_live_search_embed .wpsc_live_search" autocomplete="off" style="padding:0px !important; height:25px !important; vertical-align:top;" />
<script type='text/javascript' > /* <![CDATA[ */
jQuery('#wpsc_search_autocomplete').keypress(function(e){
if (e.keyCode == 13) {
var url = '<?php echo $pp_url ?>'+'?product_search='+jQuery(this).val();
url = encodeURI(url);
jQuery(window.location).attr('href', url);
}
});
/* ]]> */
</script>
<input type="submit" id="button" name="button" class="searchBtn" value="GO"/>
</form>
你不是已经问这个问题?我记得已经回答了这个问题。问题在于,在将HTML源发送给用户之前,cookie不会被发送,所以您需要在脚本的前面手动设置$ _COOKIE才能看到购物车。 – 2012-08-14 17:55:19
[我的网站上的某些内容在我刷新页面之前不会显示]的可能重复(http://stackoverflow.com/questions/11783793/something-on-my-site-doesnt-display-until-i-refresh-the-页) – 2012-08-14 17:57:29
但是,当我尝试手动设置cookie时出现错误。我会在一分钟内更新我的问题,只需要重新创建手动cookie,然后我会告诉你我得到的错误。 – user1269625 2012-08-14 17:57:33