鍍金池/ 問答/ PHP問答
骨殘心 回答

php.ini沒什么改的。
主要是php-fpm的配置

clipboard.png

pm = dynamic
pm.max_children = 20
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

內(nèi)存足夠大的情況下,計算一下每個子進(jìn)程會耗多少內(nèi)存,,我這個是設(shè)置比較低。

嘟尛嘴 回答

token生成后,每個請求都需要帶上的。
但沒有人規(guī)定,所有請求都是用post方法,比如RESTFul,不同的場景用不同的方法,不用header的話,客戶端和服務(wù)端的處理都很麻煩。

但這也不是絕對,早些年做移動互聯(lián)網(wǎng)的時候,某些地區(qū)的移動網(wǎng)關(guān)經(jīng)常會過濾或改寫header,這會帶來一些麻煩,如果真有碰到這種情況,就要想其它方式了。

夢若殤 回答

謝邀
刪除索引.

ALTER TABLE `表名` DROP INDEX 索引名

查看的時候,可以直接通過以下語句

SHOW CREATE TABLE `表名`

或者

SHOW INDEX FROM `表名`
誮惜顏 回答

也可以用來實現(xiàn)php的協(xié)程多任務(wù)調(diào)度,具體可以看鳥哥的博客
在PHP中使用協(xié)程實現(xiàn)多任務(wù)調(diào)度

詆毀你 回答

--no-check-certificate 參數(shù)

萌小萌 回答

我對問題的理解是:vue的history模式如何在iis中發(fā)布

iis下vue的history模式發(fā)布配置

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.web>
        <customErrors mode="On" defaultRedirect="index.html">
            <error statusCode="404" redirect="index.html" />
        </customErrors>
    </system.web>
    <system.webServer>
        <httpErrors errorMode="Custom">
            <remove statusCode="404" />    
            <remove statusCode="500" />          
            <error statusCode="500" path="/index.html" responseMode="ExecuteURL" />
            <error statusCode="404" path="/index.html" responseMode="ExecuteURL" />
        </httpErrors>
      
    </system.webServer>
</configuration>
傻叼 回答

location /xxx {

try_files $uri $uri/ /xxx/index.php?$query_string;

}

喜歡你 回答

遇到這種情況,我之前的問題是,加載圖片資源的路徑寫錯,導(dǎo)致每次點擊都發(fā)起了兩次請求

這種情況解決辦法:查看nginx、或者apache日志,看看到底發(fā)起了什么請求,或者看看firebug

涼汐 回答

用PHPunit做單元測試,單元測試如果能覆蓋完全上線前跑一次單元測試基本能鎖定有沒有問題,也就是可以做自動化測試了,整個思想主要是圍繞:

基于數(shù)據(jù)流動的思想,也就是說程序包含的三個部分:“輸入、處理邏輯、輸出”

驗證數(shù)據(jù)輸入以及輸出是否是你所想,基本就能確定程序是否正確了,具體的我給個鏈接:
http://www.phpunit.cn/

六扇門 回答

服務(wù)器沒有配置好吧

笑忘初 回答

文件不存在或無權(quán)限訪問

墻頭草 回答
location ^~ /qr {
        alias /Users/whj/web/qr/public;
        try_files $uri $uri/ @qr;
        index index.php index.html index.htm;

        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/tmp/php-cgi.sock;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME /Users/whj/web/qr/public/index.php;
        }
    }

    location @qr {
        rewrite /qr/(.*)$ /qr/index.php?/$1 last;
    }

這是我localhost下子目錄qr的nginx配置,你可以參考下

初心 回答

開發(fā)版也能顯出小程序碼。
地址欄跟官方一樣https://api.weixin.qq.com/wxa...;
傳遞的參數(shù)必須是json格式,因為是用postman測試的,數(shù)據(jù)必須要注意標(biāo)點符號。
例:{"data":"xxx"}
選擇post方法 參數(shù)選擇raw 點擊切換成application/json的header
跳轉(zhuǎn)到小程序頁面沒弄出來 報錯顯示頁面沒注冊 還在摸索

眼雜 回答

思路:

  1. 確認(rèn)matchArr在oddEven的位置,比如1,10,20
  2. 根據(jù)上面獲取的位置,取出number里的數(shù)據(jù),最后拼接

實現(xiàn):

$numbers = ['17', '38', '12', '40', '20', '47', '45', '22', '02', '19', '29', '10', '27', '41', '26', '47', '18', '24', '22', '27', '33', '47', '25', '09', '16', '32', '01', '28', '18', '38'];


// 單雙數(shù)組
$oddEven = ['1', '2', '2', '2', '2', '1', '1', '2', '2', '1', '1', '2', '1', '1', '2', '1', '2', '2', '2', '1', '1', '1', '1', '1', '2', '2', '1', '2', '2', '2'];
$oddEvenStrs = implode("", $oddEven);

// 匹配數(shù)組
$matchArr = ['1', '2', '2', '2'];
$matchArrStrs = implode("", $matchArr);

var_dump($oddEvenStrs);
var_dump($matchArrStrs);

    var_dump(count($numbers));

function findIt($from, $find, $numbers, $pos) 
{
    $result = '';
    $pos = strpos($from, $find, $pos);
    if ($pos !==  false) {
        $result .= implode(",", array_slice($numbers, $pos, 4));
        $pos += 4;
    }
    
    if (count($numbers) > $pos)
    {
        return $result . "," . findIt($from, $find, $numbers, $pos);
    }
    
    return $result;
}

$result = findIt($oddEvenStrs, $matchArrStrs, $numbers, 0);

echo $result;

var_dump(explode(",", $result));
氕氘氚 回答

clipboard.png

header包含的數(shù)據(jù)格式是key-value

在頁面可以使用ajax設(shè)置值:xhr.setRequestHeader('k', 'v');

痞性 回答
  1. addslashes
  2. htmlspecialchars
  3. htmlentities

看一下這三個用法,用特別的符號處理,

你如果是中文的話就用正則替換吧

$str = 'A:"How are you" B:"I am fine", "';

echo $str."\n";

$str = preg_replace('/"([^"]*)"/', '“${1}”', $str);

echo $str."\n";
風(fēng)畔 回答

圖片描述

crtl + shift + p 輸入liveReload 點擊下是看看,我之前也是這個問題

乖乖噠 回答

監(jiān)聽127.0.0.1就好了。ddos和這個沒關(guān)系,要看具體是ddos什么