【问题标题】:Laravel: how to include a library?Laravel:如何包含一个库?
【发布时间】:2015-09-23 17:22:58
【问题描述】:

我想使用以下内容: 图书馆文件夹中的福尔摩斯:

http://paste.laravel.com/Em

    // Determine if request is from a mobile device
Holmes::is_mobile(); // returns boolean

// Determine the type of device
$device = Holmes::get_device(); // returns string

// Determine if a specific device is being used
// Any supported device below is acceptable
// lowercased no spaces, obviously. <3
Holmes::is_ipad();
Holmes::is_blackberrytablet();

我在哪里放置什么?

在路线中:?

查看:

@if(Holmes::is_iphone())
{{ 'this is an iphone' }}
@endif

我也收到此错误: 在 Holmes 库文件的第 25 行,只能通过引用传递变量

我正在尝试从程序混乱中过渡;)

【问题讨论】:

  • > 我在哪里放置什么?这必须取决于你想做什么,没有进一步的解释就无能为力了。
  • 例如,我想在我的主页 index.blade.php 上显示/不显示一个区域,具体取决于设备,如果移动设备显示 X,如果桌面显示 Y

标签: php cross-browser laravel user-agent


【解决方案1】:

有一篇很棒的文章介绍了如何在 Laravel 4 中加载库,作者 Chris Fidao(Fideloper):
http://fideloper.com/laravel-4-application-setup-app-library-autoloading

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-13
    • 1970-01-01
    • 1970-01-01
    • 2016-10-26
    • 2015-06-13
    • 2015-08-21
    相关资源
    最近更新 更多