我正在我的系统中上传文件,它在本地工作,我使用的是Windows和xampp,但是在托管使用Ubuntu堆栈时,我的文件没有被上传.我收到一个错误,它不能写在公共文件夹中的'system'目录中.这是我的代码
$destinationPath = public_path().'/system'; // upload path
$extension = Request::file('add_students')->getClientOriginalExtension(); // getting excel extension
// dd($extension);
$fileName = rand(11111,99999).'.'.$extension; // renameing excel file
$file=Request::file('add_students')->move($destinationPath, $fileName); // uploading file to given path
$path=$file->getRealPath();
Run Code Online (Sandbox Code Playgroud)
在寻找解决方案后,我发现我应该使我的目录可写,所以我在putty中运行了以下命令
chmod 770 /var/www/html/public/system
但即使在那之后我也会收到错误Unable to write in the "/var/www/html/public/system" directory
.
我正在使用laravel 5而我的主机是数字海洋.谢谢
我的 Vue 组件中有以下方法
loadMaintenances (query = {}) {
this.getContractorMaintenances(this.urlWithPage, query).then((response) => {
this.lastPage = response.data.meta.last_page
})
}
Run Code Online (Sandbox Code Playgroud)
我想将参数传递(this.urlWithPage, query)
给我的 Vuex 操作,如下所示:
actions:{
async getContractorMaintenances ({ commit }, url, query) {
console.log(url);
console.log(query);
let response = await axios.get(url)
commit('PUSH_CONTRACTOR_MAINTENANCES', response.data.data)
return response
},
}
Run Code Online (Sandbox Code Playgroud)
问题是第一个参数url
返回一个值,但第二个参数query
返回undefined
。
我的突变如下:
mutations: {
PUSH_CONTRACTOR_MAINTENANCES (state, data) {
state.contractor_maintenances.push(...data)
},
}
Run Code Online (Sandbox Code Playgroud)
如何从第二个参数获取值?
我安装了parsedown(使用laravel 5)来解析markdown,当我运行它时,它将markdown更改为html但是浏览器显然显示解析的markdown而不是应用这些特定的样式,例如当我运行以下内容时
{{Parsedown::instance()->text('Hello _Parsedown_!')}}
我希望当我在浏览器中运行它时:Hello Parsedown!
但我得到以下内容:
<p>Hello <em>Parsedown</em>!</p>
当我查看浏览器页面源我得到以下
<p>Hello <em>Parsedown</em>!</p>
可能是什么问题?
从表中animals
我在animal_name
列中有以下值
cat
dog
cat
我想从中提取单词cat,因为它是该列中最受欢迎/常用的单词.如何使用laravel eloquent做到这一点?
laravel ×3
php ×2
eloquent ×1
file-upload ×1
html ×1
javascript ×1
laravel-5 ×1
laravel-5.4 ×1
markdown ×1
mysql ×1
parsedown ×1
vue.js ×1
vuejs2 ×1
vuex ×1