因?yàn)?code>$_SERVER['REQUEST_METHOD'] != 'POST'
問題已經(jīng)解決,寫出答案方便后來的新手查看。
1.dd打印出來的代碼,仔細(xì)查看是可以看到有數(shù)據(jù)傳過來的。在控制器里echo可以直接顯示出來數(shù)據(jù)。
2.拿到數(shù)據(jù)后,直接使用構(gòu)造查詢器update更新,$res = DB:table('xxx')->where('id',$id)->update(['oid'=>$oid]);
是配置那邊寫錯了,在一個配置文件里前面log配置了socket ,后面log又配置成了file ,相當(dāng)于后面的log配置重置了前面的配置, 關(guān)于socket配置那個是沒有問題的
Route::get('/setting/myinfo',['middleware'=>'login','HomeController@myinfo']);
改為:Route::get('/setting/myinfo','HomeController@myinfo')->middleware('login');
以下是 5.5 創(chuàng)建路由的源碼:
protected function createRoute($methods, $uri, $action)
{
// If the route is routing to a controller we will parse the route action into
// an acceptable array format before registering it and creating this route
// instance itself. We need to build the Closure that will call this out.
if ($this->actionReferencesController($action)) {
$action = $this->convertToControllerAction($action);
}
$route = $this->newRoute(
$methods, $this->prefix($uri), $action
);
// If we have groups that need to be merged, we will merge them now after this
// route has already been created and is ready to go. After we're done with
// the merge we will be ready to return the route back out to the caller.
if ($this->hasGroupStack()) {
$this->mergeGroupAttributesIntoRoute($route);
}
$this->addWhereClausesToRoute($route);
return $route;
}
以后貼報(bào)錯圖的時候,關(guān)鍵的堆棧信息要貼出來的,不然很難幫助到你。
ConvertEmptyStringsToNull 中間件是 Laravel 5.4 才開始加入的。
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.
看官方描述的意思就是為了規(guī)范化數(shù)據(jù)。
如果你確實(shí)不想這樣處理,可以在 app/Http/Kernel.php
文件中注釋掉此 middleware
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, //注釋掉此行
];
或者:
從數(shù)據(jù)庫層面,把 remark
字段的默認(rèn)值設(shè)置為 空字符串
把xdebug那里的9000改為9001,9000應(yīng)該被你本機(jī)php-fpm
默認(rèn)使用了
對的,我修改了代碼,注釋忘改了
localhost:800還是localhost:8000呢?
還有我不太理解為什么把第二個的secure設(shè)為true,從代碼上來看,你只是鏈接到了http的接口呀
就是類似于sf這種投票、反對的功能吧?如果是我來做的話,我會這樣搞:
id article_id user_id is_like
自增ID 文章ID 用戶ID 是否喜歡(1喜歡0不喜歡)
如上是表的數(shù)據(jù)結(jié)構(gòu),應(yīng)該符合你的功能需求;
而且取值、查詢也方便;
laravel中如何操作不清楚,但是如果你的欄位非要存1,2,3,4,5
這種數(shù)據(jù)結(jié)構(gòu)的話,那么原生的mysql
可以采用find_in_set函數(shù)來操作;
lnmp 環(huán)境的nginx 默認(rèn)開啟了30天的緩存,你把nginx虛擬主機(jī)配置發(fā)出來(/usr/local/nginx/conf/vhosts/目錄下
)
找到問題了 在 location ~ .php$ {下的root也要改成/usr/local/nginx/html/ci/
原因:浮點(diǎn)數(shù)的精度問題。
注意:
向下取整,即:12910.9
會被轉(zhuǎn)換為 12910
<?php
var_dump(intval(12910.9));
// 輸出
// int(12910)
浮點(diǎn)數(shù)精度
看如下執(zhí)行結(jié)果:
我們知道:$receive_money
值小于 12911
總結(jié):所以,最后 $receive_money
轉(zhuǎn)換為整型時,向下取整,結(jié)果為:12910
參考:
這是由于浮點(diǎn)數(shù)的二進(jìn)制表示形式?jīng)Q定的。
看如下示例:
我們看到第 9 行代碼 float(12911)
擴(kuò)展整數(shù)位之后,轉(zhuǎn)換成整型表示:int(129109999)
。
然后,我們對比了 float(12911)
跟 int(12911)
在二進(jìn)制上的差別。
是不是發(fā)現(xiàn)了什么?(二進(jìn)制的最后一位)這是 PHP-bug
么?當(dāng)然不是。
而且我們同樣也注意到了第 8 行代碼輸出結(jié)果為:float(129110000)
,這又是為什么呢?
為什么不是 float(129109999)
呢?
我們看一下 PHP
源碼中浮點(diǎn)數(shù)是什么:
如圖:php-float
等于 c-double
我想如下幾個問題可以解決上述的疑問:雙精度浮點(diǎn)數(shù)
的二進(jìn)制形式是如何表示的呢? 請參考:wikipedia-雙精度浮點(diǎn)數(shù)
浮點(diǎn)數(shù)是如何處理乘法運(yùn)算的呢? 請參考:wikipedia-浮點(diǎn)數(shù)的乘法和除法
如果上邊兩個問題不愿深究,可以直接參考鳥哥的一篇博客:PHP浮點(diǎn)數(shù)的一個常見問題的解答
以上為個人理解,如果錯誤之處,請指出。
首先,問問題貼代碼
其次,你判斷條件用的什么?file?
現(xiàn)在的問題是你phpmyadmin用的是xampp環(huán)境的mysql,navicat用的是自己安裝的。想要一致我覺得最好的辦法就是停用掉xammp的mysql,然后把phpmyadmin的鏈接指向你自己安裝的mysql;
.+?問好緊跟著.+,意思就是前面的.+組合(任意字符)可有可無。
^(?:0|[1-9]\d*)(?:\.\d+)?$
^(?:0|[1-9]\d*)(?:\.\d{1,2})?$
onHeaderCell和onHeaderRow用法一致
查看你的 /etc/hosts 文件 看看有沒有
127.0.0.1 localhost
這樣的映射
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
北大青鳥中博軟件學(xué)院創(chuàng)立于2003年,作為華東區(qū)著名互聯(lián)網(wǎng)學(xué)院和江蘇省首批服務(wù)外包人才培訓(xùn)基地,中博成功培育了近30000名軟件工程師走向高薪崗位,合作企業(yè)超4
中公教育集團(tuán)創(chuàng)建于1999年,經(jīng)過二十年潛心發(fā)展,已由一家北大畢業(yè)生自主創(chuàng)業(yè)的信息技術(shù)與教育服務(wù)機(jī)構(gòu),發(fā)展為教育服務(wù)業(yè)的綜合性企業(yè)集團(tuán),成為集合面授教學(xué)培訓(xùn)、網(wǎng)
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項(xiàng)目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺面向?qū)ο箝_發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國Software AG 技術(shù)顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。