wordpress プラグイン フォルダー内のファイルの HTML コンテンツをエコーしようとすると、次のエラーが発生します。
警告: filesize() [function.filesize]: http://bestideabox.com/wp-content/plugins/jww-namechord/ includes/template-files/single-form.html の統計に失敗しました /home/bestidea/public_html /wp-content/plugins/ jww-namechord/includes/core.php 44 行目
ファイルを読み取る関数は次のとおりです。
return jww_display_file(
plugins_url( 'template-files/'.$template.'.html',__FILE__ )
);
function jww_display_file( $fileToRead ){
//Open the file and read it
$handle = fopen( $fileToRead, "r" );
$contents = fread( $handle, filesize( $fileToRead ) );
fclose( $handle );
//return it
return $contents;
}
私は完全に途方に暮れています。任意のヘルプをいただければ幸いです。
これを回答としてマークする方法がわかりませんが、DaveRandom のおかげで解決策があります。
http:// ラッパーは stat() をサポートしていません。HTTP URL を filesize() することはできません。サーバーが応答を返す場合は、応答の Content-Length: ヘッダーを使用できますが、実際にはここで使用する必要はありません。その関数の本体全体を return file_get_contents($fileToRead); に置き換えるだけです。これで準備完了です。–デイブランダム
重複マークをつけてくださった方へ。回答から、同じ問題ではないことがわかります。皆さん、助けてくれてありがとう!