Ask a question about the foreach () function: PHP Warning: Invalid argument supplied for foreach () in C: \ inetpub \ wwwroot \ hp \ client_list.php on line 126
Foreach ($ idcheck as $ u => $ s) // This foreach write method reports an error
Is there any way to solve this error problem without changing the original sentence (the original sentence is used in many places on the website)? Besides (blocking the error reporting function) can php. ini be changed to implement this function? Solution!
Reply to discussion (solution)
If a problem occurs, take the initiative to solve it, rather than avoiding it.
The problem should be solved at the source rather than remedy afterwards.
Make sure that $ idcheck is an array (even an empty array ).
foreach($idcheck as $key =>$s)
Don't let code change, don't block errors ...!
If a problem occurs, take the initiative to solve it, rather than avoiding it.
The problem should be solved at the source rather than remedy afterwards.
Make sure that $ idcheck is an array (even an empty array ).
Many projects are written using this function. there are more than 30 items. now all PHP upgrades have reported errors, so we hope to have a systematic solution, otherwise, a project and a project will be modified... Understanding
Added:
Error_reporting (0); // Close the error report
?> Try
Or
In php. ini · All errors close display_errors = Off; try.
Added:
Error_reporting (0); // Close the error report
?> Try
Or
In php. ini · All errors close display_errors = Off; try.
Thank you. you still need to change the 1L method to an array.