的index.php
<?php include 'Foo.php'; ?>
<div id="middle_containe_cr" style="background-color:#F0F0FF">
<form method="post" action="actionpage.php" enctype="multipart/form-data">
<table cellspacing="30px" style="padding-left:25%">
<tr>
<td colspan="2" align="center" style="font:caption" > Hi
<form method="post" action="actionpage.php" enctype="multipart/form-data">
<table cellspacing="30px" style="padding-left:25%">
<tr>
<td colspan="2" align="center" style="font:caption" > Hi
<?php
$blObj=new Foo();
$userDetails=$blObj->SampleFunction($userID);
echo $userDetails->name;
?>
</td>
</tr>
<tr>
<td width="299">UserID</td>
<td width="302"><?php echo $userID; ?></td>
</tr>
Foo.php
include 'Bar.php';
class Foo
{
public function SampleFunction($userID)
{
$userName=null;
$dalObj=new Bar();
$userName=$dalObj->SampleFunction($userID);
return $userName;
}
}
Bar.php
include ('DataConnection.php');
class Bar
{
public function SampleFunction($userID)
{
$name='';
$db=DataConnection::DBConnect();
$stmt=$db->prepare("CALL usp_UserAccountBasicDetails(?)");
$stmt->bind_param('s',$userID);
if (!$stmt->execute())
{
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
}
else
{
$result = $stmt->get_result();
$resultSet = $result->fetch_array(MYSQLI_NUM);
$name=$resultSet[1];
$result->free_result();
}
return $name;
}
}
大家好,我在上面的代码中遇到了一个问题而我在远程服务器上托管此代码。当我执行我的localhost时,上面的代码执行成功没有任何问题。但是如果我将它上传到远程服务器,则代码不会在Function调用语句之后执行。 它只是打印&#39;嗨&#39; (在HTML td内容中),其中我连接php内容以通过两个类从db获取名称。函数调用语句下面的代码都没有执行。
请帮帮我!!谢谢!