我已经开始学习Laravel了.到目前为止,一切都运作良好.我正在按照本教程进行操作,并且我第7集陷入了困境.
问题是我不能再开始工匠了.我试图安装修补匠,我可能已经更新了工匠,所以我最终没有工匠和修补匠.我使用的是Linux Ubuntu 12.04 LTS.我已经通过命令行安装了所有内容.之后我试着跑:
php artisan --version
出现以下问题:
[ErrorException]
App\Providers\EventServiceProvider :: boot()的声明应与Illuminate\Foundation\Support\Providers\EventServiceProvider :: boot
()兼容
这是我的文件的app/Providers/EventServiceProvider.php样子:
<?php
namespace App\Providers;
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
'App\Events\SomeEvent' => [
'App\Listeners\EventListener',
],
];
/**
* Register any other events for your application.
*
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @return void
*/
public …Run Code Online (Sandbox Code Playgroud) 我对新的PayPal很困惑.我有沙盒帐户,但现在我需要为实际的实际付款创建生产(业务)帐户.但现在所有的外观和感觉都不同,所有的链接都不同.好像Paypal改变了他们的网络.我已经为以前的客户做了整合; 但现在我很失望,因为我无法弄清楚在哪里设置各种参数.当我登录时,无处可寻找"我的销售工具".
我在哪里可以找到到目前为止可用的内容:
Paypal - >简介 - >我的销售工具 - >网站首选项
Paypal - >个人资料 - >我的销售工具 - >即时付款通知
?
我需要输入网站首选项才能设置所需的参数,我还需要在即时付款通知中设置一些参数.请帮我.我需要输入以下类型的设置:
paypal paypal-subscriptions paypal-sandbox paypal-adaptive-payments paypal-rest-sdk
我可以通过这种方式将数据添加到我的数据库:
a = Model_tbl_name("3", "da", "3", "eheeee", "", "", "", "", "", "", "", "", func.now(), func.now())
db_session.add(a)
db_session.commit()
Run Code Online (Sandbox Code Playgroud)
但我不能这样做:
data = Model_tbl_name.insert().values({"title_hr":request.form['title_hr'],"text_hr":request.form['text_hr']})
Run Code Online (Sandbox Code Playgroud)
我尝试过类似的方法,但没有帮助:
data = db_session.Model_tbl_name.insert().execute({"title_hr":request.form['title_hr'],"text_hr":request.form['text_hr']})
Run Code Online (Sandbox Code Playgroud)
我最初的动机是传递所有表单数据,例如 JSON,我希望它像这样工作:
data = db_session.Model_tbl_name.insert().execute(json.loads(new_request_form))
Run Code Online (Sandbox Code Playgroud)
像这样:
users.insert().values({"name": "some name"})
Run Code Online (Sandbox Code Playgroud)
但没有帮助,我就是无法得到它。我怎样才能让它工作,我必须在values()方法中提供所有JSON数据吗?我应该如何编写该命令才能使其工作?
其次,我怎样才能抓住这个错误,因为我在 Flask 中没有收到错误,只是停止工作。我可以弄清楚如何在使用 SQLAlchemy 声明性方式时显示错误。
PS我使用Flask框架,SQLAlchemy,Python版本是3.4
当我保存文件时,我使用:
File file = new File(filename);
Run Code Online (Sandbox Code Playgroud)
但是,由于我不再具有写入文件夹的权限,我宁愿将其保存到内存中,然后将文件读取到 FileOutputStream。
我读过我可以用这种方法将文件保存到内存中:
new ByteArrayOutputStream();
Run Code Online (Sandbox Code Playgroud)
整个代码会是什么样子?上传完成后我不知道如何正确编写它。
编辑:我正在使用 Vaadins 上传插件:
public File file;
public OutputStream receiveUpload(String filename,
String mimeType) {
// Create upload stream
FileOutputStream fos = null; // Stream to write to
file = null;
if(StringUtils.containsIgnoreCase(filename, ".csv")){
try {
file = new File(filename);
fos = new FileOutputStream(file);
} catch (final java.io.FileNotFoundException e) {
new Notification("Error", e.getMessage(), Notification.Type.WARNING_MESSAGE)
.show(Page.getCurrent());
return null;
}
} else {
new Notification("Document is not .csv file", Notification.Type.WARNING_MESSAGE)
.show(Page.getCurrent());
return …Run Code Online (Sandbox Code Playgroud)