我有一个HTML代码的.php文件也在里面。通过这个文件,我调用另一个驻留在类中的.php文件中的函数。通话不起作用。它根本不在课堂上输入功能。一个类中的公共静态函数不能执行
下面分别是第一个和第二个文件的代码。
<div id="sectionGrid"> <!-- Begin of Grid Section -->
<table id="tblGrid">
<tr>
<?php
require("../Lib/displaygrid.php");
displaygrid::SetGridWithValues("*","electioncategorymaster");
?>
</tr>
</table>
</div> <!-- End of Grid Section -->
以上只是第一个文件的一部分。下面是第二个文件全部代码:
<script type="text/javascript" src="js_cookiefunctions.js"/>
<link rel="stylesheet" href="DGStyle.css" type="text/css">
<?php
final class displaygrid
{
public static function SetGridWithValues($columnNames,$tableName)
{
echo $columnNames;
require 'obfusGrid.php';
require 'obfusGridSqlDAP.php';
require("../Config/dbconfig.php");
// Load the database adapter
$db = new MySQLAdap(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
// Load the datagrid class
$x = new MyDataGrid($db);
// Set the query
$x->setQuery($columnNames, $tableName);
// Add a row selector
$x->addRowSelect("SetRowInCookie(%ID%);");
echo $columnNames;
// Apply a function to a row
function returnSomething($ID)
{
return strrev($id);
}
$x->setColumnType('ID', MyDataGrid::TYPE_FUNCTION, 'returnSomething', '%id%');
// Print the table
$x->printTable();
//Show button to return to keywords entry page
echo "<br><input id='backbutton' type='button' value='Back' onclick='ReturnBack()';>";
echo "<script type='text/javascript'>alert(cookie['row_id']);</script>";
}
}
?>
我也想知道是否在第二个代码中成功实现了与其他文件的链接?我的意思是,链接和脚本标签在上面。
你检查HTML源代码?可能有些东西没有显示出来,因为你在一个表格行里... – Franz 2009-11-13 11:08:11
你的代码很混乱。你至少应该把类和标记分开。包括cookie处理脚本和在表行中间使用链接标记也不是一个好主意......如果您完全删除了该类并包含普通的PHP代码,那么您真的会变得更好...... – Palantir 2009-11-13 11:10:13