我正在通过Laravel 4的几个教程工作,我遇到了一个障碍,我无法弄清楚或理解为什么它运行不正确.
我想要做的是组成一个查看URL的路由,然后根据它进行逻辑工作.这是我目前的代码:
Route::get('/books/{genre?}', function($genre)
{
if ($genre == null) return 'Books index.';
return "Books in the {$genre} category.";
});
Run Code Online (Sandbox Code Playgroud)
因此,如果URL是http://localhost/books,则页面应返回"Books index".如果URL读取http://localhost/books/mystery页面应返回"神秘类别中的书籍".
但是我得到一个'missing argument 1 for {closure}()'错误.我甚至提到了Laravel文档,他们的参数形式完全相同.任何帮助,将不胜感激.
我目前正在尝试使用我的应用程序实现ngCordova SQLite插件,但尚未生成可行的解决方案.我跟随Nic Raboy的博客文章,了解如何使用Ionic项目将SQLite插件实现为"T",但我仍然收到错误:错误:undefined不是对象(评估'$ window.sqlitePlugin.openDatabase')当我尝试在iOS模拟器中运行应用程序时.
我还验证了ngCordova和插件已加载到我的项目中.
这是我的脚本如何加载到我的项目中的顺序:
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="cordova.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
Run Code Online (Sandbox Code Playgroud)
我的代码如下.
app.js
angular.module('whoPaidLast', ['ionic', 'ngCordova', 'whoPaidLast.controllers', 'whoPaidLast.services'])
.run(function($ionicPlatform, $cordovaSQLite) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
db = $cordovaSQLite.openDB({ name: 'accounts.db' });
$cordovaSQLite.execute(db, 'CREATE TABLE IF NOT EXISTS accounts (id integer primary key autoincrement, firstname text, lastname text, paid numeric, date text)');
});
})
Run Code Online (Sandbox Code Playgroud)
controllers.js
angular.module('whoPaidLast.controllers', [])
.controller('DashCtrl', ['$ionicPlatform', '$scope', '$ionicModal', '$ionicActionSheet', '$cordovaSQLite', function …Run Code Online (Sandbox Code Playgroud)