0

include簡単な方法でこのエラーが発生します。

Warning:  include(/home/content/70/8352870/html/sites/mysite.com/preview/wp-content/themes/site-theme/mail/class.phpmailer.php)
[<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/content/70/8352870/html/sites/mysite.com/preview/wp-content/themes/site-theme/mail/send-message.php on line 5

これを使用してファイルを含めました:

<?php
    $path = getcwd();
    include $path.'/class.phpmailer.php';
?>

getcwdメソッドを使用せずに同じエラーが発生しますが、これは次のとおりです。

include 'class.phpmailer.php';

Warning:  include(class.phpmailer.php)
[<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/content/70/8352870/html/sites/mysite.com/preview/wp-content/themes/site-theme/mail/send-message.php on line 10

明らかに、ファイルがここにあることを確認しました:

mysite.com/preview/wp-content/themes/site-theme/mail/
class.phpmailer.php
class.pop3.php
class.smtp.php
send-message.php

私は何を間違えましたか?

4

1 に答える 1

0

これは取得しようとしている動作と同じですが、より信頼されています。

(class.phpmailerは、それを含むスクリプトと同じパスにあると思います)

<?php
$path = dirname( __FILE__ );
include $path.'/class.phpmailer.php';
?>
于 2012-07-25T14:42:17.533 に答える