久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <i id='c6Nqy'><tr id='c6Nqy'><dt id='c6Nqy'><q id='c6Nqy'><span id='c6Nqy'><b id='c6Nqy'><form id='c6Nqy'><ins id='c6Nqy'></ins><ul id='c6Nqy'></ul><sub id='c6Nqy'></sub></form><legend id='c6Nqy'></legend><bdo id='c6Nqy'><pre id='c6Nqy'><center id='c6Nqy'></center></pre></bdo></b><th id='c6Nqy'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='c6Nqy'><tfoot id='c6Nqy'></tfoot><dl id='c6Nqy'><fieldset id='c6Nqy'></fieldset></dl></div>
    <tfoot id='c6Nqy'></tfoot>

        <bdo id='c6Nqy'></bdo><ul id='c6Nqy'></ul>
    1. <small id='c6Nqy'></small><noframes id='c6Nqy'>

    2. <legend id='c6Nqy'><style id='c6Nqy'><dir id='c6Nqy'><q id='c6Nqy'></q></dir></style></legend>

    3. 無法解析的依賴解析 [Parameter #0 [ &lt;required&

      Unresolvable dependency resolving [Parameter #0 [ lt;requiredgt; $name ]](無法解析的依賴解析 [Parameter #0 [ lt;requiredgt;$姓名]])

      <small id='0xEhs'></small><noframes id='0xEhs'>

      <tfoot id='0xEhs'></tfoot>
      1. <i id='0xEhs'><tr id='0xEhs'><dt id='0xEhs'><q id='0xEhs'><span id='0xEhs'><b id='0xEhs'><form id='0xEhs'><ins id='0xEhs'></ins><ul id='0xEhs'></ul><sub id='0xEhs'></sub></form><legend id='0xEhs'></legend><bdo id='0xEhs'><pre id='0xEhs'><center id='0xEhs'></center></pre></bdo></b><th id='0xEhs'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0xEhs'><tfoot id='0xEhs'></tfoot><dl id='0xEhs'><fieldset id='0xEhs'></fieldset></dl></div>
      2. <legend id='0xEhs'><style id='0xEhs'><dir id='0xEhs'><q id='0xEhs'></q></dir></style></legend>
          <tbody id='0xEhs'></tbody>

            <bdo id='0xEhs'></bdo><ul id='0xEhs'></ul>

              • 本文介紹了無法解析的依賴解析 [Parameter #0 [ &lt;required&gt;$姓名]]的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                警告:這個問題是針對 Laravel 4 的.

                Warning: This question is Laravel 4 specific.

                我之前一直在我的控制器中使用 Facades.因此我知道代碼正在運行.現在由于各種原因需要引入依賴注入.

                I've been using Facades in my controllers before. Therefore I know the code is working. Now I need to introduce dependency injection for various reasons.

                重構控制器后出現以下錯誤:

                After refactoring the controller I get following error:

                照亮容器BindingResolutionException

                Illuminate Container BindingResolutionException

                無法解析的依賴解析 [Parameter #0 [ $name ]].

                Unresolvable dependency resolving [Parameter #0 [ $name ]].

                我不知道問題出在哪里.錯誤消息對我來說似乎很神秘,我不明白.(我沒有發現 __constructor 參數有任何問題,因為我已經為 HelpersInterface 注冊了綁定)

                I can't figure out where the problem is. The Error message seems cryptic to me and I don't understand it. (I don't see any problem with my __constructor parameters since I've registered the binding for the HelpersInterface)

                以下是我的代碼的重要部分:

                Here are the important parts of my code:

                文件:app/start/global.php

                <?php
                 
                // ...
                 
                App::bind('AcmeInterfacesHelpersInterface', 'AcmeServicesHelpers');
                

                文件:composer.json

                // ...
                 
                "autoload": {
                    // ...
                    "psr-0": {
                        "Acme": "app/"
                    }
                },
                 
                // ...
                

                文件:app/Acme/Controllers/BaseController.php

                <?php namespace AcmeControllers;
                 
                use CarbonCarbon;
                use Controller;
                use IlluminateFoundationApplication as App;
                use IlluminateViewFactory as View;
                use AcmeInterfacesHelpersInterface as Helpers;
                use IlluminateHttpResponse;
                 
                class BaseController extends Controller {
                 
                    /**
                     * @var IlluminateFoundationApplication
                     */
                    private $app;
                 
                    /**
                     * @var CarbonCarbon
                     */
                    private $carbon;
                 
                    /**
                     * @var IlluminateViewFactory
                     */
                    private $view;
                 
                    /**
                     * @var AcmeInterfacesHelpersInterface
                     */
                    private $helpers;
                 
                    function __construct(App $app, Carbon $carbon, View $view, Helpers $helpers)
                    {
                        $this->app = $app;
                        $this->carbon = $carbon;
                        $this->view = $view;
                        $this->helpers = $helpers;
                 
                        $lang = $this->app->getLocale();
                        $now = $this->carbon->now();
                 
                        $this->view->share('lang', $lang);
                        $this->view->share('now', $now);
                    }
                 
                    /**
                     * Missing Method
                     *
                     * Abort the app and return a 404 response
                     *
                     * @param array $parameters
                     * @return Response
                     */
                    public function missingMethod($parameters = array())
                    {
                        return $this->helpers->force404();
                    }
                 
                }
                

                文件:app/Acme/Services/Helpers.php

                <?php namespace AcmeServices;
                
                use IlluminateConfigRepository as Config;
                use IlluminateDatabaseConnection as DB;
                use IlluminateHttpRequest;
                use IlluminateRoutingRedirector as Redirect;
                use IlluminateSessionStore as Session;
                use IlluminateSupportFacadesResponse;
                use IlluminateTranslationTranslator as Lang;
                use IlluminateViewFactory as View;
                use AcmeInterfacesMockablyInterface;
                use MonologLogger as Log;
                
                class Helpers implements HelpersInterface {
                
                // ...
                
                    public function __construct(
                        Config $config,
                        Lang $lang,
                        View $view,
                        MockablyInterface $mockably,
                        Log $log,
                        Request $request,
                        Session $session,
                        DB $db,
                        Redirect $redirect,
                        Response $response
                    ) {
                        // ...
                    }
                
                // ...
                
                }
                

                文件:app/Acme/Providers/HelpersServiceProvider.php

                <?php namespace AcmeProviders;
                
                use IlluminateSupportServiceProvider;
                use AcmeServicesHelpers;
                
                class HelpersServiceProvider extends ServiceProvider {
                
                private $db;
                private $defaultDbConnection;
                
                protected function init()
                {
                    $this->db = $this->app['db'];
                    $this->defaultDbConnection = $this->db->getDefaultConnection();
                }
                
                public function register()
                {
                    $this->init();
                
                    $this->app->bind('helpers', function ()
                    {
                        return new Helpers(
                            $this->app['config'],
                            $this->app['translator'],
                            $this->app['view'],
                            $this->app['mockably'],
                            $this->app->make('log')->getMonolog(),
                            $this->app['request'],
                            $this->app['session.store'],
                            $this->db->connection($this->defaultDbConnection),
                            $this->app['redirect'],
                            $this->app['IlluminateSupportFacadesResponse']
                        );
                    });
                }
                

                推薦答案

                看起來你的 AcmeServicesHelpers 構造函數接受了一個 $name 參數,但不是類型暗示.

                It seems your AcmeServicesHelpers constructor takes a $name parameter, but is not type hinted.

                Laravel 的 IoC 并不神奇.如果您沒有為每個參數提供類型提示,IoC 容器將無法知道要傳入什么.

                Laravel's IoC is not magic. If your don't provide a type hint for every parameter, the IoC container has no way of knowing what to pass in.

                這篇關于無法解析的依賴解析 [Parameter #0 [ &lt;required&gt;$姓名]]的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                PHP PDO ODBC connection(PHP PDO ODBC 連接)
                Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)
                    <tfoot id='954aT'></tfoot>

                        <bdo id='954aT'></bdo><ul id='954aT'></ul>
                      • <small id='954aT'></small><noframes id='954aT'>

                        <i id='954aT'><tr id='954aT'><dt id='954aT'><q id='954aT'><span id='954aT'><b id='954aT'><form id='954aT'><ins id='954aT'></ins><ul id='954aT'></ul><sub id='954aT'></sub></form><legend id='954aT'></legend><bdo id='954aT'><pre id='954aT'><center id='954aT'></center></pre></bdo></b><th id='954aT'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='954aT'><tfoot id='954aT'></tfoot><dl id='954aT'><fieldset id='954aT'></fieldset></dl></div>
                        <legend id='954aT'><style id='954aT'><dir id='954aT'><q id='954aT'></q></dir></style></legend>

                            <tbody id='954aT'></tbody>
                          主站蜘蛛池模板: 欧美群妇大交群中文字幕 | 伊人网在线综合 | 欧洲一区二区视频 | 国产精品v | 麻豆精品一区二区三区在线观看 | 欧美中文字幕一区二区三区亚洲 | 久久a久久 | 精品国产欧美一区二区三区成人 | 欧美啊v在线观看 | 1区2区3区视频 | 99精品视频在线观看 | 亚洲国产中文字幕 | 精品欧美乱码久久久久久1区2区 | 久久久久久久久久一区 | 午夜精品一区二区三区在线视频 | 国产精品国产a级 | 99精品免费视频 | 最近中文字幕在线视频1 | 国产成人一区二区三区 | 中文字幕日韩一区 | 国产精品成人一区二区三区 | 国产传媒视频在线观看 | 国产精品毛片一区二区在线看 | 大久 | 免费小视频在线观看 | 日韩在线视频一区 | 精品久久久久久久久久久 | 日韩第一区 | 成人精品视频在线观看 | 视频一区在线播放 | 日韩一级电影免费观看 | 日韩成人在线网站 | 亚洲精品成人在线 | 超碰免费在| 国内精品久久影院 | 亚洲国产精品激情在线观看 | 毛片网络 | 久久国产麻豆 | 一二三四在线视频观看社区 | 精品久久久久久亚洲精品 | 亚洲综合色视频在线观看 |