鍍金池/ 問答/ PHP問答
近義詞 回答

Service調(diào)用其他ORM層怎么了,要不分層還有什么意義,直接去掉Service不行了

硬扛 回答

git svn隨便挑一個用

舊言 回答

limit n,m,表示起始值為n,然后取出m個記錄。如果batch size為25,那么可以:
limit 25,limit 25,25,limit50,25 ... 依次下去,默認按照表的主鍵id升序排列,每次記錄最大的已處理記錄的主鍵id(這里基于了一個假設(shè),此表是自增主鍵)

如果此表沒有新增記錄,以上方法肯定沒問題,但是如果此表有多個事務(wù)并發(fā)寫入,可能會導(dǎo)致大id記錄先于小id記錄(兩個事務(wù))被處理,導(dǎo)致這部分小id記錄永遠也不會被處理到。

問題中使用post_date其實也會有這個問題,無法保證post_date小的數(shù)據(jù)記錄一定先于post_date大的記錄先入庫。insert時間早,id小的記錄并不一定早于id大的記錄插入至數(shù)據(jù)庫。此完全取決于事務(wù)的提交時間。

寫榮 回答

問題1:
官方?jīng)]有任何文獻說明 空字符串null 效率高。

問題2:
數(shù)據(jù)庫設(shè)計是矛盾的,既然默認值是,就沒必要設(shè)置字段為 not null。如果你非要這樣,你可以在 controller 里面使用 array_filter($request->all()) 來過濾掉 null 或者 空字符串 的參數(shù)。

最后,Laravel 是在 5.4 開始加入的,同時加入的還有 TrimStrings, 官方的提交記錄沒有說明是為了什么,個人認為官方是為了標準化數(shù)據(jù)格式,進行統(tǒng)一規(guī)范。

=======分割線=======

繼續(xù)補充一下:

如果非要按照自己的要求來,也建議不要直接去注釋掉官方的中間件引用,以免其他問題,可以定義你自己的 request,在request 處理這個參數(shù)的時候,修改成自己想要的值。

php artisan make:request YourRequest

=======繼續(xù)割========

By default, Laravel includes the TrimStrings and ConvertEmptyStringsToNull middleware in your application's global middleware stack. These middleware are listed in the stack by the AppHttpKernel class. These middleware will automatically trim all incoming string fields on the request, as well as convert any empty string fields to null. This allows you to not have to worry about these normalization concerns in your routes and controllers.

If you would like to disable this behavior, you may remove the two middleware from your application's middleware stack by removing them from the $middleware property of your AppHttpKernel class.

看官方描述的意思 TrimStringsConvertEmptyStringsToNull 就是為了規(guī)范化數(shù)據(jù)。

糖豆豆 回答

原因當(dāng)然是 common 下的某個文件有錯誤,500 如果頁面空白的話,需要打開php的錯誤提示?;蛘咴趇ndex.php中加入以下代碼,就能看到錯誤信息

error_reporting(E_ALL); //E_ALL  
   
function cache_shutdown_error() {  
   
    $_error = error_get_last();  
   
    if ($_error && in_array($_error['type'], array(1, 4, 16, 64, 256, 4096, E_ALL))) {  
   
        echo '<font color=red>你的代碼出錯了:</font></br>';  
        echo '致命錯誤:' . $_error['message'] . '</br>';  
        echo '文件:' . $_error['file'] . '</br>';  
        echo '在第' . $_error['line'] . '行</br>';  
    }  
}  
   
register_shutdown_function("cache_shutdown_error");  
雅痞 回答

這不是css就能寫的么

    body{
      -webkit-user-select: none;
    }
    .box {
      display: inline-block;
      border-bottom: 2px solid red;
    }
    .cont{
      width:150px;
      height: 8px;
      resize:vertical;
      overflow: hidden;
      margin-right: 150px;    
    }
    
    
    
    <div class="box">
  <div class="cont"></div>
</div>
<p>wwwwwwwwwwwwwwwwwww</p>
黑與白 回答

1.F:/www/web/ynet/EvApp/FRS1.0/wwwroot/ynet/larvel-echo-server start 復(fù)制這個命令你自己看看能不能執(zhí)行啊
2.php.ini中是否禁用這個函數(shù)
3.換個環(huán)境試試,比如linux

初心 回答

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

乖乖瀦 回答

dataType定義了json, 但是你返回了一個數(shù)組

逗婦惱 回答

brew link php71 --force 結(jié)束舊的連接,重新開啟新連接

命多硬 回答

cms模版是很多的,你自己搜索下載一個,然后用tp套上去

涼汐 回答
Model是處理業(yè)務(wù)方面的邏輯,Controller只是簡單的協(xié)調(diào)Model和View之間的關(guān)系。
MVC架構(gòu)的職責(zé)劃分原則
撥弦 回答

交流時候用redis存儲,然后定期轉(zhuǎn)移到歷史數(shù)據(jù)庫內(nèi)做保存

鐧簞噯 回答

可以用U方法生成一個鏈接放在一個js變量里面然后放在頁面頭部head里面,這樣就可以在頁面全部都可以用了

蔚藍色 回答
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>html5實現(xiàn)上傳</title>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<div id = "result"></div>
<input id="pic" type="file" name = 'pic' accept = "image/*" onchange = "selectFile()"/>
<script type="text/javascript">
    var form = new FormData();//通過HTML表單創(chuàng)建FormData對象
    var url = '127.0.0.1:8080/'
    function selectFile(){
        var files = document.getElementById('pic').files;
        if(files.length == 0){
            return;
        }
        var file = files[0];
        //把上傳的圖片顯示出來
        var reader = new FileReader();
        // 將文件以Data URL形式進行讀入頁面
        reader.readAsBinaryString(file);
        reader.onload = function(f){
            var result = $("#result");
            var src = "data:" + file.type + ";base64," + window.btoa(this.result);
            result.append($('<img src ="'+src+'"/>'));
        }
        form.append('file',file);
    }
</script>
</body>
</html>

代碼源自這里,稍作修改,希望可以幫到你

假若需要考慮兼容性,推薦使用插件,如WebUploader,一般的組件庫都會包含上傳插件