我尝试使用"使用jQuery EasyUI构建CRUD应用程序"中给出的示例,但这一次我有一个名为get_users
:的PHP OOP函数
public function get_users() {
$rs = mysql_query("select * from users");
$items = array();
while($row = mysql_fetch_object($rs)){
array_push($items, $row);
}
$result["rows"] = $items;
echo json_encode($result);
}
如何在<table url="?????">
调用函数?
table id="dg" title="My Users" class="easyui-datagrid" style="width:700px;height:250px"
url="<?php $company->get_users(); ?>"
您似乎混淆了php和Javascript。PHP在服务器上运行,生成所需的html和javascript。
Javascript可以按照您的指示在客户端上运行。
也许它应该看起来像这个
<table id="dg" title="My Users"
class="easyui-datagrid" style="width:700px;height:250px"
url="http://me.example.com/path/to/company_get_users.php"