?ffentliche Funktion getSalarya()
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????,
$res = $this ->salary; if ($this->dept == 'Finance Department') { $res = 'Wie kannst du es wagen, die Leute zu überprüfen? in der N?he Ihres Chefs? Sie wollen nicht herumalbern是在視頻18: 26左右的時候.我們通過用test()來封裝之前if語句的過濾機制,然后使用公開getSalary()來調(diào)用私有test()這樣的寫法。發(fā)現(xiàn)工資getSalary()沒有返回我們需要獲取到的值后來我發(fā)現(xiàn)getSalary()要返回值,那么就需要通過getSalary()中的return來返回值,return $res;是沒有問題的。但是要通過getSalary()內(nèi)的變量$res來接收test()傳過來的值。就寫成$res = $this->test();然后再回去檢查test(),發(fā)現(xiàn)test()也需要一個return來把test()中的$res傳遞出去。就在test()中加上一句return $res;就可以運行了。
至少你要說一下,出現(xiàn)了什么問題吧?要不怎么幫你解答