Ensuring MySQL connection works in PHP function

后端 未结 1 416
小鲜肉
小鲜肉 2021-01-20 12:50

I have code with the following form:

tralalala();
}
$con = connectToDatabase;//This would a         


        
相关标签:
1条回答
  • 2021-01-20 13:13

    you probably need to tell it to look in the global scope:

    
         function doSomething()
         {
             global $con;
             $con->tralalala();
         }
    
    0 讨论(0)
提交回复
热议问题