鍍金池/ 問答/ PHP問答
下墜 回答

估計(jì)還是路徑問題

孤慣 回答

翻了一下源碼,沒有相關(guān)的方法。

好奇為啥有這樣的需求,最好說明業(yè)務(wù)需求情況,再來想解決方案比較合適。

鐧簞噯 回答

$new_arr=array_column($tags,0,1);

不討喜 回答

先查看在chrome下是否被當(dāng)成廣告了

夢一場 回答

把拉取順序倒置一下,在生成消息模板的時候,就預(yù)先把要接收的用戶分發(fā)出去;

生成message_content表數(shù)據(jù),要選擇下發(fā)的用戶,選完用戶可以把這些用戶ID存放在redis中,然后用戶上線的時候,從redis中讀取,有數(shù)據(jù)就給提示,用戶已查看,就刪除,然后存入message表。

(如果不用redis,直接插入message表也行,只需要插入message_content_iduser_id就可以了,讀取狀態(tài)字段在數(shù)據(jù)表中默認(rèn)設(shè)置為0未查看,然后采用批量插入的方式,也挺快的)

結(jié)合一下 @lscho 的數(shù)據(jù)表設(shè)計(jì)就差不多了。


以上推送模式都有一個缺點(diǎn):就是消息模板不能實(shí)時推送給用戶,必須要用戶下次登陸或者觸發(fā)某個頁面,才能得到消息。workerman的消息推送框架了解一下

不舍棄 回答

問題是出現(xiàn)了phpmyadmin的2002錯誤,無法登錄 MySQL 服務(wù)器
1、可能因?yàn)閙ysqld沒有啟動
2、phpmyadmin中將config.sample.inc.php復(fù)制成config.inc.php (參考http://www.jb51.net/article/3...

將$cfg['Servers'][$i]['host'] = 'localhost'; 
改為$cfg['Servers'][$i]['host'] = '127.0.0.1'; 
安若晴 回答

一樣的,都是用于url的編碼

櫻花霓 回答

php中暫時還不支持Set這種數(shù)據(jù)結(jié)構(gòu),所以可以考慮使用array來實(shí)現(xiàn)

<?php

Class Set {
    private $arr = [];
    public function add($val) {
        if (!in_array($val, $this->arr)) {
            array_push($this->arr, $val);
        }
        return $this->arr;
    }
}

$set = new Set();
print_r($set->add(2));
print_r($set->add(2));
print_r($set->add(3));
print_r($set->add(4));

能力有限,如果有錯誤希望不吝指教.

墨染殤 回答

看你問了好幾個 draft-js 的問題,難道你使用之前不看官方文檔嗎?https://draftjs.org/docs/over...

如果把root和index 兩行 放到 location / 里面 證書就是綠色的,沒問題, 如果把root和index 放到 ocation /外面 證書就不灰色的,就不行了
圖片描述

圖片描述

乖乖瀦 回答

php也可以直接實(shí)現(xiàn),但是用前端方法的話用ajax去請求數(shù)據(jù)就行了,具體流程:
1.提交表單時ajax提交數(shù)據(jù)到服務(wù)器;
2.每次網(wǎng)站打開時,向服務(wù)器請求一次數(shù)據(jù),然后將數(shù)據(jù)用字符串拼接的方式插入網(wǎng)頁。

如果需要提交表單后就展示新增“卡片”,在ajax回調(diào)中實(shí)現(xiàn)字符串拼接并插入就行了。

鹿惑 回答

前后端分離方式,實(shí)現(xiàn)跨域:

1.模擬后端開發(fā),拉后端代碼。(要后端代碼,沒坑,效率低)
2.前端開啟web服務(wù)器,node服務(wù)器或者nginx服務(wù)器。(前端自由,不用管后端)

node服務(wù)器:

proxyTable: {
  '/api': {
    target: 'http://segmentfault.com',
    pathRewrite: {
      '^/api': ''
    }
  }
}
1.比如ajax接口"/getMessage",本地"localhost:8080/getMessage",有跨域的問題。
2.localhost:8080 => http://segmentfault.com,本地開啟服務(wù)器實(shí)現(xiàn)代理。

nginx服務(wù)器:

http {
    server {
        listen  8080; #本地端口        
        server_name localhost;
        location  ~*/get*|post* { #nginx正則匹配(可高度自定義)            
            proxy_pass http://segmentfault.com; #反向代理
        }
    }
}
1.比如ajax接口"/getMessage",本地"localhost:8080/getMessage",有跨域的問題。
2.localhost:8080 => http://segmentfault.com,本地開啟服務(wù)器實(shí)現(xiàn)代理。
3.nginx反向代理更多配置查詢http://www.nginx.cn/115.html。

參考:
1.Vue-cli proxyTable
2.nginx搭建web服務(wù)器

紓惘 回答
function totalLen(...$string){
    $lens = [];
    foreach ($string as $content) {
      $lens[] = strlen($content);
    }
    reutrn $lens;
}
硬扛 回答

在mysql官網(wǎng)上看到的
On the other hand, you should not use mysql_use_result() for locking reads if you are doing a lot of processing for each row on the client side, or if the output is sent to a screen on which the user may type a ^S (stop scroll). This ties up the server and prevent other threads from updating any tables from which the data is being fetched.

魚梓 回答

首先看你直接輸出了,典型的 PHP_FPM 沒執(zhí)行,將其當(dāng)文件了,問題出在這里,我看一下你的DockerFile或者docker-compose.yml
這里我覺得有點(diǎn)問題,你直接將其代理到這個IP去了,你在docker里設(shè)這個IP了嗎?

    if (!-e $request_filename) {
        proxy_pass http://192.168.10.2:1215;
    }
咕嚕嚕 回答

兄弟,有個地方不對,你第二次篩選出來的結(jié)果應(yīng)該賦值回去才對~
你的代碼:

$collect = collect($arr)
->whereInStrict('rule', $rule)
->map(function ($value) use ($rule) {
   return collect($value['children'])->whereInStrict('rule', $rule);
});

修改:

$collect = collect($arr)
    ->whereInStrict('rule', $rule)
    ->map(function ($value) use ($rule) {
      $value['children'] = collect($value['children'])->whereInStrict('rule', $rule)
      ->toArray(); //此處要賦值回去,而且要把結(jié)果轉(zhuǎn)為數(shù)組
 return $value;
});

這樣的結(jié)果就是你想要的,總體思路沒毛病~

心悲涼 回答

你的php-fpm如果是官方鏡像,php-fpm用戶組應(yīng)該是www-data

編輯你的Dockerfile

FROM php:7.0-fpm
RUN chown -R www-data 你的WEB目錄
未命名 回答

圖片描述把 /去掉, 換成about

最好是 再去熟悉一邊 vue-router 文檔 和demo

巷尾 回答

將用戶下單的時間加上24小時(失效時間)轉(zhuǎn)成時間戳傳到后臺,然后起24小時的定時器;
頁面刷新去后臺取失效時間和當(dāng)前時間的差起定時器...