【问题标题】:Laravel load external URL in modal windowLaravel 在模态窗口中加载外部 URL
【发布时间】:2021-05-19 11:23:28
【问题描述】:

我的刀片上有一个按钮,可以在 laravel-livewire 中打开一个模态窗口,例如

<a href="#" wire:click="confirmI">

另外,这是我的控制器

public function confirmI() 
    {
        $this->reset();
        $this->eurl='https://websiteurl.com';
        $this->confirmingI = true;
    }

和我在刀片中的模型

<x-jet-dialog-modal wire:model="confirmingI">
 <x-slot name="title">
            WebPage
        </x-slot>
 <x-slot name="content">
            <div class="flex -mx-3 mt-2">
here is data
</div>
</x-slot>
 <x-slot name="footer">
 </x-slot>
</x-jet-dialog-modal>

我想要的是在读取的模式中加载$eurl value 网站内容

“这是数据”

【问题讨论】:

    标签: php laravel laravel-blade laravel-livewire


    【解决方案1】:

    你可以利用file_get_contents ——将整个文件读入一个字符串

    $this->eurl = file_get_contents('https://google.com');
    

    Displaying Unescaped Data

    <div class="flex -mx-3 mt-2">
        {!! $eurl !!}
    </div>
    

    【讨论】:

      【解决方案2】:
      <x-jet-dialog-modal>
       <x-slot name="title">
                  WebPage
              </x-slot>
       <x-slot name="content">
          <div class="flex -mx-3 mt-2">
              {{ $confirmingI }}
          </div>
      </x-slot>
       <x-slot name="footer">
       </x-slot>
      </x-jet-dialog-modal>
      

      【讨论】:

      • 您好,谢谢 $confirmingI 的价值,我实际上想通过 URL 加载外部网站的内容
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多