how can convert $files contain to array?

后端 未结 6 1385
[愿得一人]
[愿得一人] 2020-12-11 14:01

How do I solve this error?

A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: admin/tour.php
Line Numbe         


        
6条回答
  •  长情又很酷
    2020-12-11 14:25

    Actually doing like this you wil get the file or the value you want to.

    foreach ($files as $img) {   //line 81
      echo $img; // echo the Var and you will see..
    }
    

    This line -> $files = $this->multi_upload->go_upload(); probably come from a file object in your form, right? Then it must to be named like this file[] and not only file. You need to be specific that it is an Array. Otherwise nothing will happen.

提交回复
热议问题