在 PHP 中接受函數作爲參數 - Accept function as parameter in PHP

問題:

I've been wondering whether is possible or not to pass a function as parameter in PHP;我一直想知道是否可以在 PHP 中將函數作爲參數傳遞; I want something like when you're programming in JS:當你用 JS 編程時,我想要這樣的東西:

object.exampleMethod(function(){
    // some stuff to execute
});

What I want is to execute that function somewhere in exampleMethod.我想要的是在exampleMethod中的某處執行該函數。 Is that possible in PHP?這在 PHP 中可能嗎?


解決方案:

參考: https://stackoom.com/en/question/BKVN
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章