鍍金池/ 問答/ PHP問答
怣人 回答

filemtime 獲取 最后修改時(shí)間這個(gè)是正常的. 只是一個(gè)是24小時(shí)制, 一個(gè)是12小時(shí)制.
filectime 獲取inode修改時(shí)間
fileatime 取得文件的上次訪問時(shí)間

溫衫 回答
<view class='tab'>
  <view class='tab-menu'>
    <view class='menu' wx:for="{{tabs}}" wx:key="{{index}}" data-tabidx="{{index}}" bindtap='switchTab'>
      <text>{{item}}</text>
      <view class='currentTab' wx:if="{{tabIdx === index}}"></view>
    </view>
  </view>
  <swiper class='tab-content' current='{{tabIdx}}' bindchange='scrollTab'>
    <swiper-item>
      <view class='question-wrap'>
        <view class='question-header'>
          <text>[{{questions[current].type}}]</text>
          <text class='total'><text class='current'>{{current+1}}</text>/{{questions.length}}</text>
        </view>
        <view class='title'>{{questions[current].title}}</view>
        <view class='options'>
          <view class='opt {{questions[current].right === index ? "right" : ""}}' wx:for="{{questions[current].options}}" wx:key="{{index}}">
            <view class='tag'>
              <image src='/icons/right.png' wx:if="{{questions[current].right === index}}"></image>              
            </view>
            <view class='content'>{{item.content}}</view>
            <text class='rate'>{{item.rate}}</text>
          </view>
        </view>
      </view>
      <view class='btns'>
        <button disabled='{{current <= 0}}' bindtap="showPre">上一題</button>
        <button disabled='{{current >= questions.length-1}}' bindtap="showNext">下一題</button>
      </view>
    </swiper-item>

    <swiper-item>
      <scroll-view scroll-y class='totalRank' lower-threshold="150" bindscrolltolower="getRank">
        <view class='user' wx:for="{{ranks}}" wx:key="{{index}}">
          <image src='{{item.img_url}}' class='avator'></image>
          <view class='name'>{{item.name}}</view>
          <view class='score'>{{item.score}}分</view>
          <view class='order'>第{{item.no}}名</view>
        </view>
      </scroll-view>
    </swiper-item>
  </swiper>
</view>
page {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
  font-size: 30rpx;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tab-content {
  flex: 1;
  overflow-y: auto;
}

.tab-menu {
  height: 104rpx;
  display: flex;
}

.currentTab {
  background: #42c541;
  height: 2rpx;
  width: 132rpx;
  position: absolute;
  bottom: 20rpx;
}

.tab-menu .menu {
  flex: 1;
  text-align: center;
  font-size: 28rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

swiper-item {
  overflow: auto;
}

.totalRank {
  height: 100%;
}

.avator {
  width: 60rpx;
  height: 60rpx;
  border-radius: 50%;
}

.user {
  height: 88rpx;
  display: flex;
  align-items: center;
  background: #f4f4f4;
  padding: 0 43rpx;
  margin: 30rpx 30rpx 0 30rpx;
  border-radius: 10rpx;
  box-sizing: border-box;
  font-size: 24rpx;
}

.name, .score, .order {
  flex: 1;
  text-align: center;
}
.name{
  margin-left: 50rpx;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order {
  color: #42c541;
  text-align: right;
}

.question-wrap{
  display: flex;
  flex-direction: column;
  margin: 0 30rpx;
  border: 2rpx solid #DCDCDC;
  border-radius: 10rpx;
  box-sizing: border-box;
  padding: 0 50rpx;
  margin-top: 40rpx;
}
.question-header{
  display: flex;
  justify-content: space-between;
  margin-top: 60rpx;
}
/* .question-wrap .options{
  max-height: 600rpx;
  overflow: auto;
} */
.question-header .total{
  color: #E3E3E3;
}
.question-header .current{
  color: #353535;
}
.question-wrap .title{
  margin-top: 36rpx;
  min-height: 178rpx;
}
.opt{
  text-align: center;
  position: relative;
  background: #F0F0F0;
  margin-bottom: 44rpx;
  border-radius: 10rpx;
  padding: 26rpx 20rpx;
  display: flex;
  align-items: center;
}
.opt image, .opt .tag{
  width: 46rpx;
  height: 34rpx;
}
.opt .rate{
  min-width: 3em;
}
.opt .content{
  flex: 1;
  text-align: center;
}
.right{
  background: #FF920B;
  color: #FFF;
}
.btns{
  display: flex;
  margin-top: 60rpx;
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 148rpx;
}
.btns button{
  width: 260rpx;
  height: 88rpx;
  line-height: 88rpx;
  text-align: center;
  border-radius: 10rpx;
  color: #FFF;
  background: #41C629;
}

.btns button:active{
  background: #179B16;
  color: #A2D7A2;
}
.btns button[disabled]:active{
  background: #F7F7F7;
  color: #ACACAC;
}
Page({
  data: {
    tabs: [
      '題目分析',
      '成績(jī)排名'
    ],
    ranks: [
      { name: '張三', score: 93 },
      { name: '李四', score: 60 },
      { name: '趙六', score: 8 },
      { name: '王五', score: 1000 },
      { name: '馮二', score: 45 }
    ],
    questions: [],
    current: 0,
    tabIdx: 0
  }
})
淚染裳 回答
當(dāng)一個(gè)字符串被當(dāng)作一個(gè)數(shù)值來取值,其結(jié)果和類型如下:

如果該字符串沒有包含 '.','e' 或 'E' 并且其數(shù)字值在整型的范圍之內(nèi)(由 PHP_INT_MAX 所定義),該字符串將被當(dāng)成 integer 來取值。其它所有情況下都被作為 float 來取值。

該字符串的開始部分決定了它的值。如果該字符串以合法的數(shù)值開始,則使用該數(shù)值。否則其值為 0(零)。合法數(shù)值由可選的正負(fù)號(hào),后面跟著一個(gè)或多個(gè)數(shù)字(可能有小數(shù)點(diǎn)),再跟著可選的指數(shù)部分。指數(shù)部分由 'e' 或 'E' 后面跟著一個(gè)或多個(gè)數(shù)字構(gòu)成。

參見 PHP: String字符串 - 字符串轉(zhuǎn)換為數(shù)值

九年囚 回答

1.你的表里面已經(jīng)有有xpm字段了.就不用增加字段了吧.

添加字段 alter table totaltable add xpm int

2.現(xiàn)在你表中的xpm是沒有數(shù)據(jù)的.你想把數(shù)據(jù)填充進(jìn)來.

如果學(xué)生不多,你可以手動(dòng)添加.(利用軟件)
數(shù)量足夠多,那么你就把數(shù)據(jù)整理好.生產(chǎn)sql.重新添加

file_put_contents 沒有文件就創(chuàng)建前提是 你資源路徑得存在,并且有權(quán)限,路徑不存在的話 就是報(bào)這個(gè)錯(cuò)誤

document監(jiān)聽點(diǎn)擊事件
e.target!=彈窗 的時(shí)候,關(guān)閉

卟乖 回答
親測(cè)可用:
class BaseActiveController extends \yii\rest\ActiveController
{
    public function behaviors()
    {
        $behaviors = parent::behaviors();

        $behaviors['timeFilter'] = [
            'class' => 'app\filters\ActionTimeFilter',
            'except'=>['test']
        ];

        return $behaviors;
    }
}
值得注意的是,behaviors() 中需要繼承父類 behaviors() 方法返回的內(nèi)容,否則父類 behaviors()就會(huì)被完全覆蓋了。
懶豬 回答

檢查看看是否字段名沒對(duì)上

怣痛 回答

這個(gè)情況很詭異,也是題主的邏輯有問題,setInterval大概每3500ms執(zhí)行一次,但是ajax異步的結(jié)果什么時(shí)候返回呢?這個(gè)時(shí)間不確定,所以邏輯不好,建議修改:

  1. 在ajax添加timeout
  2. 不使用setInterval,而是在ajax的返回中根據(jù)判定使用來遞歸調(diào)用自身;
function ChangeTime() {

    $.ajax({
        type: "POST",
        url: "/Home/Index",
        success: function(msg){
               if(msg == 1){
                  //clearInterval(iCount); //停止刷新事件,防止出現(xiàn)請(qǐng)求多次
                  location.href = '/Home/reg_result_no_card';
                  return false;
               } else {
                   ChangeTime();
               }
        }

    });
}

1: uuid
2:使用更小的微秒

// 生成一萬個(gè)
for ($i = 0; $i < 10000; ++ $
    
    do {
        $time = str_replace('.', '', microtime(true));
        // 這樣子重復(fù)的概率已經(jīng)比較小了,如果還怕重復(fù),只能手動(dòng)篩選了
        $key = $time . str_pad(1, 9999, STR_PAD_LEFT);
        
        // 可以裝進(jìn)數(shù)組判斷,但注意內(nèi)存
        if (不存在) {
            // 存起來
            break;
        }
        
        // 不存在 繼續(xù)循環(huán)
    } while(true);
    
}
離夢(mèng) 回答

從代碼和http請(qǐng)求截圖中來看,暫時(shí)看不出問題。

既然這樣,排除法找問題:

可以先把這個(gè)請(qǐng)求加入 csrf 白名單,看是否功能正常

class VerifyCsrfToken extends BaseVerifier
{
    /**
     * 這些 URI 將免受 CSRF 驗(yàn)證
     *
     * @var array
     */
    protected $except = [
        'your url',
    ];
}

既然這樣,繼續(xù)嘗試其它方法:

請(qǐng)把 csrf_token 放入 data 里傳輸過去,字段名稱使用 _token 嘗試下。

詆毀你 回答

var {...newData} = this.data
如果是數(shù)組
var [...newData] = this.data
這是es6的語法

念舊 回答

感謝各位的回答,猜測(cè)是和主題文件損壞有關(guān)的。不過我已經(jīng)轉(zhuǎn)到WordPress了。

柒喵 回答

vue是一個(gè)基于對(duì)象的組件庫(所有的 組件都是對(duì)象,他的 方法啊,data啊都存在于組件對(duì)象里面。
而你要用一個(gè)操作dom的庫去操作Vue對(duì)象,把vue數(shù)據(jù)給修改了,這怎么可能呢,就算把dom節(jié)點(diǎn)改了其實(shí)也沒什么作用,vue會(huì)下次改回來。
而原生的 js 的確是可以操作對(duì)象,你把這個(gè)對(duì)象暴露出來,然后通過js操作,然后改數(shù)據(jù),但是呢,那你去操作vue對(duì)象,為什么不直接使用vue呢?

瞄小懶 回答

使用workerman對(duì)在同個(gè)搶拍房間的用戶進(jìn)行消息推送(該過程為了向各個(gè)用戶推送信息還循環(huán)建立多個(gè)curl post提交請(qǐng)求)
這里不是很清楚為什么還要建立curl連接 建立連接會(huì)比較耗時(shí)啊