简体   繁体   English

不需要的刷新页面引导程序/字体

[英]unwanted refresh page bootstrap/font-face

hi there ia have a html code like this 嗨,我有这样的HTML代码

<html lang="en">
    <head>
    <link href="css/style.css" rel="stylesheet">

</head>


<body>
<?php 
$_SESSION["iphrase"] = $_SESSION["iphrase"] +1;
echo $_SESSION["iphrase"];?>
</body>

</html>

and in css: 并在CSS中:

@font-face {
    font-family: 'Droid-Naskh';
    font-style: normal;
    font-weight: normal;
    src: url('../fonts/DroidNaskh-Regular.woff2') format('woff2'), url('../fonts/DroidNaskh-Regular.woff') format('woff');
}

body {
  font-family: 'Droid-Naskh';}

for each refresh page I expect this result: 1,2,3,4,5,6... 对于每个刷新页面,我希望得到以下结果:1,2,3,4,5,6 ...

But it print: 1,3,5,7 但它打印:1,3,5,7

the problem is for this code: 问题是此代码:

 body {
      font-family: 'Droid-Naskh';}

why and how fixed it? 为什么以及如何解决?

Try something like this 试试这个

$_SESSION["iphrase"] = (isset($_SESSION["iphrase"])) ? $_SESSION["iphrase"] + 1 : $_SESSION["iphrase"];

echo $_SESSION["iphrase"];

I'm considering you've written session_start(); 我正在考虑您已经写了session_start(); at the top, somewhere in the code before incrementing session value. 在顶部,在增加会话值之前在代码中的某个位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM