Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide copy warnings in PHP

Tags:

php

I know it's not a good practice to hide the warnings using @copy, but what other alternatives are there?

Is there any way you can make sure copy would work or not ?

like image 336
johnlemon Avatar asked Jan 13 '12 15:01

johnlemon


People also ask

How do I ignore PHP errors?

If you find an error message particularly annoying and you are sure it definitely does not apply to you, PHP has a method for you to silence the message entirely. If you place an at symbol, @, before a function that generates an error, PHP will catch the error and silence it entirely.

How do I turn off PHP warnings in WordPress?

Either way, you're looking for the “WP_DEBUG” portion of the wp-config. php file. Click the “Save Changes” button in the top right. Once the file is saved, this will disable the PHP warnings in WordPress.


1 Answers

Use is_readable() and is_writable() to check the status of the source and target before attempting the copy().

like image 189
George Cummins Avatar answered Oct 21 '22 18:10

George Cummins