朋友。
我有一个像这样的PHP类:
class DiffFunctions {
function showMessage($msg){
echo "<script type='text/javascript'>alert('$msg')</script>";
}
}
我在PHP页面中尝试过这段代码:
<?php
include_once './Classes/DiffFunctions.php';
$myFuns2 = new DiffFunctions();
?>
<button id="sendMsg" type="submit" onclick="$myFuns2->showMessage('You have clicked the button')">Click Here To Show The Message</button>
但它不起作用!