ningskyer
V2EX  ›  PHP

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

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

    这特么什么意思。。。

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

    这是什么用法

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

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