你看下這樣行不行。
把input的value用數(shù)組表示,然后后臺(tái)接收到的所有input在一個(gè)數(shù)組中
$hotels = array();
$arr = $_POST['arr'];
foreach ($arr as $k => $v) {
if($k%3 == 0){
if($v){
if(!$arr[$k+1] || !$arr[$k+2]){
echo json_encode(array(
"code" => -1,
"msg" => "如果填酒店名,就必須填金額,時(shí)間",
));
die;
}
$hotels[] = array(
"name" => $v,
"cost" => $arr[$k+1],
"time" => $arr[$k+2],
);
}else{
$hotels[] = array(0, 0, 0);
}
}
}
echo json_encode(array(
"code" => 0,
"msg" => "success",
));
這已經(jīng)解決
?。。?!
storage
整個(gè)目錄的權(quán)限都改吧。
通過(guò)分析換了一種方法解決
利用BootstrapTable這個(gè)onClickRow事件函數(shù) 然后在單獨(dú)調(diào)用google map的api
產(chǎn)生點(diǎn)擊循環(huán)列表在map中展現(xiàn)圖片信息
修復(fù)bug $element[0].addEventListener('click',fm);
function BootstrapTable() {
$.ajax({
"type": "get",
"url": imgJson,
"async": false,
"success": function (data) {
window.res = data.data;
//console.log(data.data);
$('#table').bootstrapTable({
data: data.data,
pagination: true,
searchAlign: "right",
buttonsAlign: "left",
showRefresh: true,
searchOnEnterKey: false,
singleSelect: true,
maintainSelected: false,
search: true,
pageSize: 10,
sortable: false,
paginationLoop: true,
toolbar: '#toolbar', // 工具欄ID
toolbarAlign: 'right', // 工具欄對(duì)齊方式
onClickRow: function (item, $element) {
var arr = {};
arr.Latitude = parseFloat(item.Latitude);
arr.Longitude = parseFloat(item.Longitude);
var latLng = new google.maps.LatLng(arr.Latitude, arr.Longitude);
var fm = mapLine.markerClickFunction(item, latLng);
$element[0].addEventListener('click',fm);
},
columns: [
{
field: 'id',
align: 'center',
title: 'id'
},
{
field: 'photo_title',
align: 'center',
title: 'photo_title'
},
{
field: 'photo_time',
align: 'center',
title: 'photo_time'
}
]
});
}
});
};
用
set names utf8
設(shè)置一下編碼試試
select * from t2 LEFT JOIN t1 ON t2. m_top_user_list like '%t1. user_id%'
raw:文件內(nèi)容。
blame:按行顯示最新提交的信息。
history:文件的歷史記錄。
直接round不可能出現(xiàn)這個(gè)吧。。只有計(jì)算才會(huì)出現(xiàn)這種,然后你里面2個(gè)點(diǎn)的是什么
js代碼:
<script type="text/javascript">
$(function () { $("#file_upload").change(function () { uploadImage(); }) }) function uploadImage() { // 判斷是否有選擇上傳文件 var imgPath = $("#file_upload").val(); if (imgPath == "") { alert("請(qǐng)選擇上傳圖片!"); return; } //判斷上傳文件的后綴名 var strExtension = imgPath.substr(imgPath.lastIndexOf('.') + 1); if (strExtension != 'jpg' && strExtension != 'gif' && strExtension != 'png' && strExtension != 'bmp') { alert("請(qǐng)選擇圖片文件"); return; } // var formData = new FormData($('#art_form')[0]); var formData = new FormData(); formData.append('fileupload',$('#file_upload')[0].files[0]); $.ajax({ type: "POST", cache: false, headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, url: "/admin/upload", data: formData, contentType: false, processData: false, success: function(data) { console.log(data); $('#art_thumb').attr('src', data); $("input[name='map']").val(data); }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert("上傳失敗,請(qǐng)檢查網(wǎng)絡(luò)后重試"); } }); } </script>
后端代碼:
//文件上傳
public function upload(Request $request) { $file = $request->file('fileupload'); //如果是有效的上傳文件 if($file->isValid()) { // 獲取原文件的文件類(lèi)型 $ext = $file->getClientOriginalExtension(); //文件拓展名 // 生成新文件名 $newfile = md5(date('YmdHis').rand(1000,9999).uniqid()).'.'.$ext; // 將文件上傳到本地服務(wù)器 //將文件從臨時(shí)目錄移動(dòng)到制定目錄 $path = $file->move(public_path().'/uploads',$newfile); // 將上傳文件的路徑返回給客戶(hù)端 return '/uploads/'.$newfile; } }
開(kāi)始是不是調(diào)用了focus的方法
你把置頂?shù)奈恼路旁诰彺嬷谢蛘吡硪粡埍碇校ㄎ恼卤硪灿兄庙斘恼碌臄?shù)據(jù)),那么你先在這邊取置頂文章,然后再按之前最后一條文章的添加時(shí)間來(lái)分頁(yè),當(dāng)然增加過(guò)濾條件非置頂文章。這樣性能會(huì)快很多,尤其是有對(duì)“添加時(shí)間”欄位做了索引。
$res = $db->table('cate')->where('parentid =0')->select();
$array=array();
foreach ($res as $key =>$val){
$cate = $db->table('cate')->where('parentid ='.$val['id'])->select();
$array[$key]['id']=$cate['id'];
$array[$key]['disabled']=false;
$array[$key]['groupName']=$val['categoryname'];
$array[$key]['groupId']=$val['id'];
$array[$key]['selected']=false;
$array[$key]['name']=$cate['categoryname'];
}
echo json_encode($array);exit;
建議對(duì)于這種嵌有HTML的內(nèi)容 通過(guò)使用模板文件
進(jìn)行存儲(chǔ),使用占位符
的形式來(lái)對(duì)內(nèi)容進(jìn)行替換
。
<html>
<head>
{$phpmailer_css_style}
</head>
<body>
<div class="edm-layout">
<img src="{$host_url}images/logo.png">
<div class="line"></div>
</div>
<div class="edm-content">
<div class="edm-hithere">
嗨,{$user_name} <br>XXX {$prod_total}XXXXX<br>XXXXXX{$this_total} XXX
</div>
<div class="edm-products">
{$row_distinct}
</div>
</div>
</div>
</body>
</html>
<?php
$php_version = version_compare(phpversion(), '7');
/**
* 必須php 7
*/
if ($php_version === -1) {
die('Need a high version of php 7.1.*');
}
/**
* EmailTemplate
*/
class EmailTemplate
{
/**
* @param string $template_path 模板路徑
* @param array $args 變量組
* @return string 渲染后的
* @throws Exception
*/
public static function render(string $template_path, array $args): string
{
if (!file_exists($template_path)) {
throw new Exception("Not found template fiel.", 1);
}
$template = file_get_contents($template_path);
$result = preg_replace_callback('!\{\$(\w+)\}!', function ($matches) use ($args) {
$arg = $matches[1];
return $args[$arg] ?? '';
}, $template);
return $result;
}
}
$body = EmailTemplate::render(
'email.template',
[
'host_url' => 'http://xxx',
'phpmailer_css_style' => 'empty',
'user_name' => '張三',
'prod_total' => '100.00',
'this_total' => '10000.00',
'row_distinct' => 'empty',
]
);
這樣就實(shí)現(xiàn)了一個(gè)簡(jiǎn)單的模板替換。
ThinkingSession應(yīng)該是以dll的形式當(dāng)做程序集引入的,目前看來(lái)這個(gè)dll被改動(dòng)位置或者刪除了。 檢查一下項(xiàng)目的程序集引用,是否缺失了這個(gè)dll。
mysql編碼設(shè)置下utf-8
后端簡(jiǎn)化下接口,就做成一個(gè)接口
bind對(duì)象進(jìn)去就行了setInterval(test.all.bind(test),1000);
很簡(jiǎn)單的問(wèn)題花了兩天時(shí)間,終于解決了,我F...佛慈悲,咳咳嗯,正經(jīng)說(shuō)說(shuō)怎么回事
項(xiàng)目是要部署在阿里云上對(duì)外的,簡(jiǎn)單說(shuō)就是要大家在地址欄敲個(gè)xxx.com就能訪(fǎng)問(wèn)到我的網(wǎng)站。而樓主之前一直項(xiàng)目組做本地調(diào)試
假設(shè)本地有兩個(gè)Vue工程,如果一個(gè)工程被npm run dev,就會(huì)跑在localhost:8080,那么80端口被占用了,不能再占一個(gè)8080,只能改用8081,做法如題問(wèn)中描述
但是,當(dāng)發(fā)布到阿里云之后,設(shè)置好的8081不起作用了怎么回事呢?
現(xiàn)在針對(duì)同一個(gè)阿里云分配的IP地址,樓主申請(qǐng)了兩個(gè)域名hehe.com和lala.com,希望訪(fǎng)問(wèn)hehe.com時(shí)對(duì)應(yīng)顯示工程hehe,訪(fǎng)問(wèn)lala.com時(shí),對(duì)應(yīng)顯示工程lala
其實(shí)我們的所有設(shè)置都是針對(duì)開(kāi)發(fā)環(huán)境(關(guān)鍵字:dev/development),而部署在阿里云上被稱(chēng)為生產(chǎn)環(huán)境(關(guān)鍵字:production)
那生產(chǎn)環(huán)境怎么還不受代碼控制呢?這個(gè)需要展開(kāi)來(lái)講:
我們開(kāi)發(fā)的工程,需要一步步測(cè)試調(diào)試
在開(kāi)發(fā)環(huán)境下修改一小段code都可以看到相應(yīng)的效果
而當(dāng)你解決所有bug,認(rèn)為代碼perfect的時(shí)候,就會(huì)npm run build
這是做什么呢?就是把你的項(xiàng)目打包成一個(gè)靜態(tài)文件,什么叫靜態(tài)文件?Emmm...就理解成打包成一坨,里里外外都不能改的,可以直接運(yùn)行出你perfect的效果
這個(gè)文件在哪里呢?當(dāng)你build之后會(huì)看到根目錄下有個(gè)dist
文件,吶,就是這個(gè),先記住他哦
然后就可以運(yùn)行了么?Nope
這是個(gè)文件,讓它run在阿里云服務(wù)器上我們需要一個(gè)代理服務(wù)器nginx
,你可以理解為你有個(gè).doc文件,總需要個(gè)Microfoft Word來(lái)打開(kāi)的對(duì)吧,這里的nginx
可以幫你打開(kāi)靜態(tài)文件讓它run起來(lái)
所以
nginx.conf
,吶關(guān)鍵來(lái)啦,這個(gè)配置文件可以幫助我們實(shí)現(xiàn)對(duì)應(yīng)域名,對(duì)應(yīng)文件的強(qiáng)大功能啦,下面粘貼一小段配置代碼,可以看到hehe工程和hehe.com對(duì)對(duì)應(yīng)起來(lái)了,可以看到lala工程和lala.com對(duì)對(duì)應(yīng)起來(lái)了,端口號(hào)
可以通過(guò)修改listen
后的數(shù)字來(lái)設(shè)置#第一個(gè)服務(wù)器
server {
#這里的default_server標(biāo)識(shí)服務(wù)器為默認(rèn)服務(wù)器,無(wú)對(duì)應(yīng)域名情況下會(huì)對(duì)應(yīng)至該服務(wù)器
listen 80 default_server;
#和上一句語(yǔ)義相同,上句對(duì)應(yīng)Ipv4這里對(duì)應(yīng)Ipv6
listen [::]:80 default_server;
#對(duì)應(yīng)的靜態(tài)文件根目錄,把你的hehe工程的dist里面的內(nèi)容放在這里
root /var/www/hehe;
index index.html index.htm index.nginx-debian.html;
#對(duì)應(yīng)的第一個(gè)域名
server_name hehe.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ @router;
index index.html;
}
location @router{
rewrite ^.*$ /index.html last;
}
}
#第二個(gè)服務(wù)器
server {
#這里應(yīng)該不設(shè)置default_server否則會(huì)報(bào)錯(cuò),注:端口號(hào)可與另一服務(wù)器重復(fù)
listen 80;
listen [::]:80;
#對(duì)應(yīng)的靜態(tài)文件路徑
root /var/www/lala;
index index.html index.htm index.nginx-debian.html;
#對(duì)應(yīng)的第二個(gè)域名
server_name lala.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ @router;
index index.html;
}
location @router{
rewrite ^.*$ /index.html last;
}
}
是不是兩邊有空格或者什么的,把兩邊的空格去掉試試?。?/p>
不是有個(gè)socket嗎。。。雖然我不會(huì)用。。。
北大青鳥(niǎo)APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國(guó)IT技能型緊缺人才,是大數(shù)據(jù)專(zhuān)業(yè)的國(guó)家
北大青鳥(niǎo)中博軟件學(xué)院創(chuàng)立于2003年,作為華東區(qū)著名互聯(lián)網(wǎng)學(xué)院和江蘇省首批服務(wù)外包人才培訓(xùn)基地,中博成功培育了近30000名軟件工程師走向高薪崗位,合作企業(yè)超4
中公教育集團(tuán)創(chuàng)建于1999年,經(jīng)過(guò)二十年潛心發(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),是中國(guó)一站式人才培養(yǎng)平臺(tái)、一站式人才輸送平臺(tái)。2014年4月3日在美國(guó)成功上市,融資1
曾工作于聯(lián)想擔(dān)任系統(tǒng)開(kāi)發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動(dò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ù), 熟練的跨平臺(tái)面向?qū)ο箝_(kāi)發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫(kù),具有快速界面開(kāi)發(fā)的能力,對(duì)瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁(yè)制作和網(wǎng)頁(yè)游戲開(kāi)發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開(kāi)發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國(guó)Software AG 技術(shù)顧問(wèn),美國(guó)Dachieve 系統(tǒng)架構(gòu)師,美國(guó)AngelEngineers Inc. 系統(tǒng)架構(gòu)師。