簡體   English   中英

我如何在控制器功能中使用我的 html 標簽

[英]how can i use my html tags inside controllers functions

這是我的 Laravel html

    <!-- end left -->
    <div class="right">
        <--call function-->
        <?php
            use App\Http\Controllers\CVController;
            echo CVController::functionName();
        ?>

        <div class="right-container">
           @if(count($form_data['oc_experiences'])>count($form_data['oc_formations']))
            <hr>
            <!-- test experience -->
            <hr>
      @endif
        </div>

    </div>  

我調用了這個函數……它起作用了。 但我不知道如何在控制器中使用 html

這是我的控制器

 <?php
    namespace App\Http\Controllers;
    use Illuminate\Http\Request;
    use DB;
    use App;
    use Cache;
    use Session;
    use Exception;
    use App\Http\Controllers\CommonController;
    use App\Http\Controllers\PermController;
    use App\Http\Controllers\CVController;
    use App\Http\Requests;
    use App\Http\Controllers\Controller;

    class CVController extends Controller
    {
        use CommonController;
        use PermController;

        //my function that i would like to use 
        public static function functionName()
        {
            //how can i use my html tags here ????
        }
    }

我如何在控制器功能中使用我的 html 標簽,請幫忙

例如與 ECHO

 public static function functionName()
        {
          echo '<p>Hello</p>';  //how can i use my html tags here ????
        }

為什么在控制器中使用 HTML?

只需在 Laravel 視圖文件夾中創建一個刀片文件。 作為。 filename.blade.php並在您的控制器方法中編寫此內容僅用於調用您的視圖或刀片。

public function methodName(){
   return view('filename');
}

嘗試這個。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM