tp5与tp3的主要区别(TP5.1的那些坑)
tp5与tp3的主要区别(TP5.1的那些坑)if($file){ $filename = ""; public function upfile(){ $file = $this->request->file('pics')->getInfo(); (这里一定一定要加,不然获取到的是对象,很坑的对象)
PHP文件上传是很常见的,但是当前后端分离后,前端和后端的框架都是按照开发人员自己去定的, 然单独写上传是很麻烦的 在插件泛滥的今天,原生的表单上传很少用户会去研究 这里通过亲身经历介绍TP的文件上传类进行结合 实例方便好用的文件上传操作。
-
前端框架datatable
html.push('<input id="file-upload" type="file" name="pics" >');
2. 后端框架TP5文件上传类接收
public function upfile(){
$file = $this->request->file('pics')->getInfo();
(这里一定一定要加,不然获取到的是对象,很坑的对象)
$filename = "";
if($file){
if( !file_exists($path) ){
决的办法就是
$file = $this->request->file('pics')->getInfo();
参考文献
https://blog.csdn.net/hexiaoniao/article/details/85064475
希望能帮到大家