ningskyer
V2EX  ›  PHP

PHP $this->instance('path', $this->{$path.'Path'}());

  •  
  •   ningskyer · Apr 20, 2016 · 2979 views
    This topic created in 3873 days ago, the information mentioned may be changed or developed.

    这特么什么意思。。。

    $this->{$path.'Path'}()

    这是什么用法

    6 replies  •  2016-04-20 15:36:46 +08:00
    ningskyer
    ningskyer
    OP
    Apr 20, 2016
    1
    $path 是个字符串变量
    jfcherng
    jfcherng
    Apr 20, 2016
    2
    $this->{$path.'Path'}() = 調用名為 $path.'Path' 的方法
    geeglo
    geeglo
    Apr 20, 2016
    3
    假设 $path = 'x';

    整句话 = $this->instance('path', $this->xPath());
    ningskyer
    ningskyer
    OP
    Apr 20, 2016
    5
    @Slienc7 nice
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1596 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 16:30 · PVG 00:30 · LAX 08:30 · JFK 11:30
    ♥ Do have faith in what you're doing.