错误邮件程序:依赖项类使用我的自动加载而不是作曲家类
我试图在我的项目中使用 symfony/Mailer 与作曲家的依赖关系,问题是我在我的类中有自己的自动加载,但是当我尝试发送邮件时出现此错误:
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Mailjet\Transport\MailjetTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Mailjet\Transport\MailjetTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\OhMySmtp\Transport\OhMySmtpTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\OhMySmtp\Transport\OhMySmtpTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Amazon\Transport\SesTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Amazon\Transport\SesTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: session_start(): Session cannot be started after headers have already been sent in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/Youtech/Authentication.php on line 14
Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php:10) in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/Youtech/entryPoint.php on line 62
邮件已成功发送,但类中的一些邮件是尝试使用 Mailer 依赖项正在尝试使用我的加载器加载类。 这是我的自动加载的代码
function autoloader($className)
{
$fileName = str_replace('\\', '/', $className) . '.php';
$file = __DIR__ . '/../' . $fileName;
if(!file_exists($file)){
$file = __DIR__ .'/../src/Entities/'.$className.'.php';
}
include $file;
}
spl_autoload_register('autoloader');
和我的项目树,我当然不知道在没有供应商的情况下是否需要它,但我与供应商一起运行它。
── Youtech
│ ├── Authentication.php
│ ├── EntryPoint.php
│ └── Routes.php
├── bootstrap.php
├── cli-config.php
├── composer.json
├── composer.lock
├── config
│ └── Autoload.php
├── public
│ ├── apache.access.log
│ ├── index.php
│ └── resources
│ ├── bootstrap
│ │ ├── css
│ │ │ ├── bootstrap-responsive.min.css
│ │ │ └── bootstrap.min.css
│ │ ├── img
│ │ │ ├── glyphicons-halflings-white.png
│ │ │ └── glyphicons-halflings.png
│ │ └── js
│ │ └── bootstrap.min.js
│ ├── css
│ │ └── theme.css
│ ├── font
│ │ ├── Amaranth-Bold.php
│ │ ├── Amaranth-Bold.z
│ │ ├── NotoSe.php
│ │ └── NotoSe.z
│ ├── images
│ │ ├── Blank Document.pdf
│ │ ├── bg.png
│ │ ├── icons
│ │ │ ├── css
│ │ │ │ └── font-awesome.css
│ │ │ └── font
│ │ │ ├── fontawesome-webfont3294.eot
│ │ │ ├── fontawesome-webfont3294.ttf
│ │ │ ├── fontawesome-webfont3294.woff
│ │ │ └── fontawesome-webfontd41d.eot
│ │ ├── img.jpg
│ │ ├── jquery-ui
│ │ │ └── picker.png
│ │ ├── logo.png
│ │ └── user.png
│ ├── index2.php
│ ├── scripts
│ │ ├── common.js
│ │ ├── datatables
│ │ │ └── jquery.dataTables.js
│ │ ├── flot
│ │ │ ├── jquery.flot.js
│ │ │ ├── jquery.flot.pie.js
│ │ │ └── jquery.flot.resize.js
│ │ ├── jquery-1.9.1.min.js
│ │ └── jquery-ui-1.10.1.custom.min.js
│ └── userimage
│ ├── user-1.jpeg
│ ├── user-2.jpeg
│ ├── user-3.jpeg
│ ├── user-4.jpeg
│ └── user-5.png
├── sen_forage_db.sql
├── src
│ ├── Entities
│ │ ├── Abonnement.php
│ │ ├── Attribution.php
│ │ ├── Compteur.php
│ │ ├── Consommation.php
│ │ ├── Facture.php
│ │ ├── Habitant.php
│ │ ├── Numero.php
│ │ ├── Reglement.php
│ │ ├── Role.php
│ │ ├── User.php
│ │ └── Village.php
│ ├── Forage
│ │ ├── Controller
│ │ │ ├── Abonnement.php
│ │ │ ├── Client.php
│ │ │ ├── Compteur.php
│ │ │ ├── Consommation.php
│ │ │ ├── Facture.php
│ │ │ ├── Forage.php
│ │ │ ├── Numero.php
│ │ │ ├── User.php
│ │ │ └── Village.php
│ │ └── ForageRoutes.php
│ └── Utility
│ ├── ChiffreEnLettres.php
│ └── Pdf.php
└── templates
├── abolist.html.php
├── abonnementcreate.html.php
├── addConso.html.php
├── admin.html.php
├── clientcreate.html.php
├── compteurlist.html.php
├── consommationsliste.html.php
├── empty.html.php
├── gestionnaireclientele.html.php
├── gestionnairecommercial.html.php
├── gestionnairecompteur.html.php
├── home.html.php
├── layout.html.php
├── listeclients.html.php
├── listefacture.html.php
├── listevillage.html.php
├── listuser.html.php
├── login.html.php
├── loginerror.html.php
├── navbar.html.php
├── newcpt.html.php
├── permissionerror.html.php
├── sommaireReglement.html.php
├── test.html.php
├── usercreate.html.php
└── villagecreate.html.php
以及我现在使用邮件程序的索引 php 。
<?php
use Symfony\Component\Mailer\Transport;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mime\Email;
try {
include __DIR__ . '/../bootstrap.php';
include __DIR__ . '/../config/autoload.php';
$dsn = 'gmail+smtp://user:pass@default';
$transport = Transport::fromDsn($dsn);
$mailer = new Mailer($transport);
$email = (new Email())
->from('mail')
->to('mail')
->priority(Email::PRIORITY_HIGH)
->subject('Time for Symfony Mailer!')
->text('Sending emails is fun again!');
$mailer->send($email);
echo 'error';
http_response_code(301);
$route = ltrim(strtok($_SERVER['REQUEST_URI'], '?'), '/');
// echo password_hash('passer123',PASSWORD_DEFAULT);
$entryPoint = new \Youtech\entryPoint($route,new \src\Forage\ForageRoutes($entityManager),$_SERVER['REQUEST_METHOD']);
$entryPoint->run();
} catch (\Exception $e) {
$title = 'An error has occurred';
$output = 'Database error: ' . $e->getMessage() . ' in ' . $e->getFile() . ':' . $e->getLine();
}
im trying to use symfony/Mailer depencies with composer on my project , the problem i have my own autoload in my class but when i try to send a mail there is this error :
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Mailjet\Transport\MailjetTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Mailjet\Transport\MailjetTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Mailchimp\Transport\MandrillTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Sendgrid\Transport\SendgridTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\OhMySmtp\Transport\OhMySmtpTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\OhMySmtp\Transport\OhMySmtpTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Amazon\Transport\SesTransportFactory.php): Failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: include(): Failed opening '/Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/../src/Entities/Symfony\Component\Mailer\Bridge\Amazon\Transport\SesTransportFactory.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php on line 10
Warning: session_start(): Session cannot be started after headers have already been sent in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/Youtech/Authentication.php on line 14
Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/sen_forage/config/autoload.php:10) in /Applications/XAMPP/xamppfiles/htdocs/sen_forage/Youtech/entryPoint.php on line 62
the mail is sent with success but some of the of class are trying to use of Mailer dependencies are trying to load class using my loader.
here is the code of my autoload
function autoloader($className)
{
$fileName = str_replace('\\', '/', $className) . '.php';
$file = __DIR__ . '/../' . $fileName;
if(!file_exists($file)){
$file = __DIR__ .'/../src/Entities/'.$className.'.php';
}
include $file;
}
spl_autoload_register('autoloader');
and the tree of my project i dont know if it will be need without the vendor of course but i run it with the vendor.
── Youtech
│ ├── Authentication.php
│ ├── EntryPoint.php
│ └── Routes.php
├── bootstrap.php
├── cli-config.php
├── composer.json
├── composer.lock
├── config
│ └── Autoload.php
├── public
│ ├── apache.access.log
│ ├── index.php
│ └── resources
│ ├── bootstrap
│ │ ├── css
│ │ │ ├── bootstrap-responsive.min.css
│ │ │ └── bootstrap.min.css
│ │ ├── img
│ │ │ ├── glyphicons-halflings-white.png
│ │ │ └── glyphicons-halflings.png
│ │ └── js
│ │ └── bootstrap.min.js
│ ├── css
│ │ └── theme.css
│ ├── font
│ │ ├── Amaranth-Bold.php
│ │ ├── Amaranth-Bold.z
│ │ ├── NotoSe.php
│ │ └── NotoSe.z
│ ├── images
│ │ ├── Blank Document.pdf
│ │ ├── bg.png
│ │ ├── icons
│ │ │ ├── css
│ │ │ │ └── font-awesome.css
│ │ │ └── font
│ │ │ ├── fontawesome-webfont3294.eot
│ │ │ ├── fontawesome-webfont3294.ttf
│ │ │ ├── fontawesome-webfont3294.woff
│ │ │ └── fontawesome-webfontd41d.eot
│ │ ├── img.jpg
│ │ ├── jquery-ui
│ │ │ └── picker.png
│ │ ├── logo.png
│ │ └── user.png
│ ├── index2.php
│ ├── scripts
│ │ ├── common.js
│ │ ├── datatables
│ │ │ └── jquery.dataTables.js
│ │ ├── flot
│ │ │ ├── jquery.flot.js
│ │ │ ├── jquery.flot.pie.js
│ │ │ └── jquery.flot.resize.js
│ │ ├── jquery-1.9.1.min.js
│ │ └── jquery-ui-1.10.1.custom.min.js
│ └── userimage
│ ├── user-1.jpeg
│ ├── user-2.jpeg
│ ├── user-3.jpeg
│ ├── user-4.jpeg
│ └── user-5.png
├── sen_forage_db.sql
├── src
│ ├── Entities
│ │ ├── Abonnement.php
│ │ ├── Attribution.php
│ │ ├── Compteur.php
│ │ ├── Consommation.php
│ │ ├── Facture.php
│ │ ├── Habitant.php
│ │ ├── Numero.php
│ │ ├── Reglement.php
│ │ ├── Role.php
│ │ ├── User.php
│ │ └── Village.php
│ ├── Forage
│ │ ├── Controller
│ │ │ ├── Abonnement.php
│ │ │ ├── Client.php
│ │ │ ├── Compteur.php
│ │ │ ├── Consommation.php
│ │ │ ├── Facture.php
│ │ │ ├── Forage.php
│ │ │ ├── Numero.php
│ │ │ ├── User.php
│ │ │ └── Village.php
│ │ └── ForageRoutes.php
│ └── Utility
│ ├── ChiffreEnLettres.php
│ └── Pdf.php
└── templates
├── abolist.html.php
├── abonnementcreate.html.php
├── addConso.html.php
├── admin.html.php
├── clientcreate.html.php
├── compteurlist.html.php
├── consommationsliste.html.php
├── empty.html.php
├── gestionnaireclientele.html.php
├── gestionnairecommercial.html.php
├── gestionnairecompteur.html.php
├── home.html.php
├── layout.html.php
├── listeclients.html.php
├── listefacture.html.php
├── listevillage.html.php
├── listuser.html.php
├── login.html.php
├── loginerror.html.php
├── navbar.html.php
├── newcpt.html.php
├── permissionerror.html.php
├── sommaireReglement.html.php
├── test.html.php
├── usercreate.html.php
└── villagecreate.html.php
and the index php where i use the mailer just for now .
<?php
use Symfony\Component\Mailer\Transport;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mime\Email;
try {
include __DIR__ . '/../bootstrap.php';
include __DIR__ . '/../config/autoload.php';
$dsn = 'gmail+smtp://user:pass@default';
$transport = Transport::fromDsn($dsn);
$mailer = new Mailer($transport);
$email = (new Email())
->from('mail')
->to('mail')
->priority(Email::PRIORITY_HIGH)
->subject('Time for Symfony Mailer!')
->text('Sending emails is fun again!');
$mailer->send($email);
echo 'error';
http_response_code(301);
$route = ltrim(strtok($_SERVER['REQUEST_URI'], '?'), '/');
// echo password_hash('passer123',PASSWORD_DEFAULT);
$entryPoint = new \Youtech\entryPoint($route,new \src\Forage\ForageRoutes($entityManager),$_SERVER['REQUEST_METHOD']);
$entryPoint->run();
} catch (\Exception $e) {
$title = 'An error has occurred';
$output = 'Database error: ' . $e->getMessage() . ' in ' . $e->getFile() . ':' . $e->getLine();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论