我需要帮助将此代码转换为 codeigniter MVC 我有 3 个文件 php Openlink3.php 用于查看器 class.php 用于类和 databaseConnection.php 用于模型
我在将此 php 文件转换为 codeigniter 时遇到问题。请帮我。
这是我的 PHP 代码 Openlink.php
<?php
include("DatabaseConnection.php");
include("class.php");
Global $AppCode;
//$AppCode='0001';
$user='0772';
$db = new dbconnection();
$conn = $db->dbOpen();
$misApp = new misApplication();
$sql="SELECT a.RAL_Code,a.RAL_App_Name,a.RAL_Remarks,b.RAL_APPIconLocation,b.RAL_ApplicationLink FROM R_Application_List as a ,R_Application_Links as b where a.RSC_Active=1 and a.RAL_Code=b.RAL_APPCODE";
$rs=odbc_exec($conn,$sql);
$appcount;
echo "<table align=center cellpadding=10>";
echo "<tr height=120>";
$appcount=0;
while (odbc_fetch_row($rs))
{
$appcode=odbc_result($rs,"RAL_Code");
$appname=odbc_result($rs,"RAL_App_Name");
$desc=odbc_result($rs,"RAL_Remarks");
$icon=odbc_result($rs,"RAL_APPIconLocation");
$applink=trim(odbc_result($rs,"RAL_ApplicationLink"));
if($appcount==3){
echo "<tr height=120>";
//echo "<td>";
$appcount=0;
}
//echo "<td>".$appcode."</td>";
//echo "<td>".$appname."</td>";
echo "<td valign=bottom><img src=".$icon."height=30 width=150 onclick='openApp(\"$appcode\",\"$user\",\"$applink\");' </img></td>";
//echo "<td><input type=\"button\" ></td>"
//echo "<td>".$desc."</td>";
echo '<script>openApp();</script>';
$appcount++;
//echo $icon."<br/>";
}
echo "</table>";
?>
<img src="dtr.png" height="30" width="150" onclick=openApp("0001","<?php echo $user; ?>","<?php echo $appLink = $misApp->getAppLink($conn,"0001",$user); ?>") ></img></br>
<input type="button" id="btn.DTR"; name="btn.Dtr"; value="DTR"; onclick='openApp("0001","<?php echo $user; ?>","<?php echo $appLink = $misApp->getAppLink($conn,"0001",$user); ?>")'/>
<input type="button" id="jose"; name="btn.OpenApp"; value="Approval System(test)"; background="dtr.png";onclick='openApp("0014","<?php echo $user; ?>","<?php echo $appLink = $misApp->getAppLink($conn,"0002",$user); ?>")'/>
<script language="javascript">
function openApp(Appcode, User, link){
var OpenLink;
OpenLink = link+"?A1="+User+"&A2="+Appcode; // Concatenating strings
//alert(OpenLink);
//document.write (OpenLink); // printing the Concatenated string
//window.open(OpenLink);
//window.open(OpenLink,'_blank', 'toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,left=10000, top=10000, width=10, height=10, visible=none', '');
window.location.href = OpenLink;
}
</script>
</html>
这是我的 PHP 代码 class.php
<?php
class misApplication{
public function getAppLink($actveConn,$appCode,$user){
$linktoOpen;
$sql="select * from R_Application_Links where RAL_APPCode='$appCode'";
$rs=odbc_exec($actveConn,$sql);
while (odbc_fetch_row($rs))
{
$a=odbc_result($rs,"RAL_APPCode");
$b=odbc_result($rs,"RAL_InstallationLink");
$link=odbc_result($rs,"RAL_ApplicationLink");
$d=odbc_result($rs,"RAL_APPIconLocation");
}
$linktoOpen = $link.$user.$appCode;
return trim($link);
odbc_close($actveConn);
}
}
?>
数据库连接.php
<?php
class dbconnection{
public function dbOpen(){
$conn=odbc_connect("Global02","USER-00","USER00");
if (!$conn){
exit("Connection Failed: " . $conn);
}
else{
return $conn;
}
}
}
?>
当我转换它时,它总是有错误。