小编Sun*_*day的帖子

在Laravel 4 DB :: transaction()上传递多个参数?

我在尝试这个:

  $iddocente = '1';
  $idcurso = '2';
  DB::transaction(function() {
    DB::table('users')->insert(
      array('docente' => $iddocente, 'curso' => $idcurso)
    );
  });
Run Code Online (Sandbox Code Playgroud)

但没有工作.请帮帮我.

php

5
推荐指数
1
解决办法
1928
查看次数

我如何在Laravel中使用包含文件?

我正在使用Laravel,并且为我的项目找到了一个图表库。这个库(libchart)是php,它使用以下代码:

include "../libchart/classes/libchart.php";
Run Code Online (Sandbox Code Playgroud)

但是,如果我将此代码放在自己的视图中,则会收到此错误:

include(../libchart/classes/libchart.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory
Run Code Online (Sandbox Code Playgroud)

我不知道如何在视图中添加代码或在Laravel中添加库。

当我下载库时,我有这个:

libchart
->libchart
->demo
Run Code Online (Sandbox Code Playgroud)

然后我粘贴:

myproject
->app
  ->views
    ->libchart
      ->libchart
      ->demo
Run Code Online (Sandbox Code Playgroud)

并且include "../libchart/classes/libchart.php";是:

libchart
->libchart
->demo
  ->LineChartTest.php
Run Code Online (Sandbox Code Playgroud)

编辑:

我尝试了这个:

  1. 我在应用程序中创建了一个名为grafico的目录。
  2. 我这样做:

    Route::get('pruebaimagen', function() { include_once(app_path() . '/grafico/libchart/classes/libchart.php'); $data['libchart'] = new Libchart(); return View::make('template', $data); });

在return View::make('template', $data);这类型的模板,我必须用?我现在收到此错误:

Class 'Libchart' not found
Run Code Online (Sandbox Code Playgroud)

php include laravel-4

5
推荐指数
3
解决办法
2万
查看次数

标签 统计

php ×2

include ×1

laravel-4 ×1