Home > Backend Development > PHP Tutorial > 关于ci框架引入文件的问题

关于ci框架引入文件的问题

WBOY
Release: 2016-06-06 20:30:16
Original
2112 people have browsed it

我在使用CI框架发送邮件的时候,需要引入文件,并用到use函数,为什么ci报错呢?

<code>public function login_action(){
    require 'vendor/autoload.php';
    use Mailgun\Mailgun;
}
</code>
Copy after login
Copy after login

然后就会报错,

<code>Parse error: syntax error, unexpected 'use' (T_USE) in.......
</code>
Copy after login
Copy after login

请问这个怎么解决呢

回复内容:

我在使用CI框架发送邮件的时候,需要引入文件,并用到use函数,为什么ci报错呢?

<code>public function login_action(){
    require 'vendor/autoload.php';
    use Mailgun\Mailgun;
}
</code>
Copy after login
Copy after login

然后就会报错,

<code>Parse error: syntax error, unexpected 'use' (T_USE) in.......
</code>
Copy after login
Copy after login

请问这个怎么解决呢

use 不支持导入函数和常量,一般导入都是在function外面吧

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template