What’s a simple but secure method to get file contents into WordPress?

I had to dig pretty deep for this too, and eventually figured out some way to do this.

in my solution I used the following:

WP_Filesystem();
global $wp_filesystem;
$wp_filesystem->exists( '/path/to/file' ); //use any other functions available in the Filesystem API: @see https://developer.wordpress.org/reference/classes/wp_filesystem_direct/

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)