Is_dir and Is_file inside foreach loop error. |
I am getting error in my foreach loop using
Array to string conversion error. On the line where is_dir and is_file. Question: Where have I gone wrong? How to fix it? Seems to be if any files in sub folder throws the error that's what causing error. PHP Code: foreach ($files as $image) { Controller function PHP Code: public function index() {
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
Perhaps your directory map is returning an array that is more complex than you have allowed for, so your $image is not a filename but an array of filenames. If you output the files array you generated with a var_dump what do you get?
|
Welcome Guest, Not a member yet? Register Sign In |