Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 php 代码。我的代码是这样的 class Connection {function connect(){$link = 'Connected'; } }
class Connection {
function connect(){
$link = 'Connected';
}
$con = new Connection(); $con -> connect(); echo $con->link;//connected 在这里我想回显变量,但它没有得到帮助我
$con = new Connection();
$con -> connect();
echo $con->link;//connected
您将必须有return一个值,如下所示:
return
function connect() { return 'Connected'; }