V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
commoccoom
V2EX  ›  问与答

请教一个关于 ThinkPHP5.1 的问题

  •  
  •   commoccoom · Jul 24, 2020 · 850 views
  •   You need to sign in to view this topic
    This topic created in 2106 days ago, the information mentioned may be changed or developed.

    别人的代码var_dump($this->fetch());得出的是 string 类型,我的给出的是 class 类型。这是什么原因呢?

    1 replies    2020-07-25 08:24:39 +08:00
    commoccoom
        1
    commoccoom  
    OP
       Jul 25, 2020
    找到原因了,https://www.kancloud.cn/manual/thinkphp5_1/354065 从 V5.1.38+版本开始,视图渲染输出的时候,如果你需要获取渲染内容(比如用于生成 HTML 文件),需要改成:

    ```$html = $this->fetch()->getContent();```
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2374 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 01:01 · PVG 09:01 · LAX 18:01 · JFK 21:01
    ♥ Do have faith in what you're doing.