Ich verstehe die $query-Variable der „automatischen globalen Instanziierung' in Abschlussabfragen nicht ganz.
土豆
土豆 2018-06-07 23:21:09
0
3
1040

Warum nicht die Abhängigkeitsinjektion in Schließungen verwenden? Zum Beispiel

function(thinkdbQuery $q) {

$q->where('sex', 0)->where('salary', '>', '8000');

}

tp5 .1, ich kann es so erfolgreich ausführen.


土豆
土豆

Antworte allen(1)
亚连

你这是一个匿名函数,不是闭包

  • Antwort php手册,匿名函数的定义, 第一句,“Anonymous functions, also known as closures,(匿名函数,也叫闭包。)” 手册地址:http://php.net/manual/en/functions.anonymous.php 我知道js里闭包的定义是“有权访问另一个函数作用域中的变量的函数",但在php中闭包好像和匿名函数是一回事。
    土豆 Autor 2018-06-08 13:22:45
  • Antwort 理论上讲闭包和匿名是不同的概念,但是PHP好像把他们合在一起了,匿名就是闭包,闭包就是匿名。你可以看看这篇文章http://www.php.cn/php-weizijiaocheng-401974.html
    亚连 Autor 2018-06-08 15:36:17
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage