我正在使用后端运行Node的Express应用程序。我试图从服务访问NodeJS的组件中有2个函数。两者的链接在服务中相同。它能够连接服务中的功能之一。
但是,它显示<?php
session_start();
require_once('info.vc.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>COUPONS | CARDS</title>
<meta name="author" content="STASHTECH">
<meta name="robots" content="NOINDEX, NOFOLLOW" />
<link href="../_lib/v/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script src="../_lib/v/ckeditor/ckeditor.js"></script>
<link rel="stylesheet" href="../cards/css/style.css">
<link rel="apple-touch-icon" href="../img/favicon.png">
<link rel="icon" href="../img/favicon.png">
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
</head>
<body class="bg-color-white">
<?php require_once('header-only.php'); ?>
<div id="my-modal" class="modal text-align-center">
<div class="m-content">
<div class="m-header">
<span class="close">×</span>
<h1>THANK YOU FOR CLAIMING A COUPON!</h1>
</div>
<div class="m-body">
<h1 class="bold_font color-mwc-orange">YOU HAVE CHOSEN:</h1>
<br>
<?php
$claim_coupon = $rowProduct['title'];
$claim_coupon = strtoupper($claim_coupon);
echo '<h1 class="bold_font color-mwc-blue">'.$claim_coupon.'</h1>';
?>
<br>
<div id="container">
<?php
if ($packageid <= 1) {
$ribbon = 'ribbon-elite';
} else if ($packageid == 2) {
$ribbon = 'ribbon-premium';
} else if ($packageid == 3) {
$ribbon = 'ribbon-luxury';
}
echo('<a href="membership.php"><img style="display:inline;" src="../img/'.$ribbon.'.png"></a> ');
if($packageid == 1) {
echo('<h1 style="display:inline;">Elite <br/></h1>');
} else if($packageid == 2) {
echo('<h1 style="display:inline;">Premium <br/></h1>');
} else if($packageid == 3) {
echo('<h1 style="display:inline;">Luxury <br/></h1>');
}
?>
</div>
<h3>to view other coupons you have claimed, <a href="membership.php" class="no-underline">click here.</a></h3>
<br>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 spacer"></div>
<div class="col-md-5">
<img src="../img/uploads/<?php echo($rowProduct['photosrc']); ?>" class="img-responsive clinic">
<img src="../img/shadow-bottom.png" class="img-responsive">
<div class="col-md-12 spacer"></div>
<div class="col-xs-12 text-align-center">
<input type="submit" class="full_width registerbtn " id="back" value="BACK">
</div>
<div class="col-md-12 border-top spacer"><br></div>
<div class="col-md-12 spacer"><br></div>
</div>
<div class="col-md-6 col-md-offset-1 border-left">
<br>
<div class="col-md-12">
<br>
<br>
<?php echo($rowProduct['body']); ?>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 spacer">
</div>
</div>
<div class="row border-top">
<div class="col-md-12">
<br> RELATED CARDS <br><br>
<?php
$i = 0;
foreach($lstProduct as $rowProduct) {
?>
<div class="col-md-4 spacer">
<div class="col-md-12">
<?php
$packageid = $rowProduct['packageid'];
if ($packageid <= 1)
$ribbon = 'ribbon-elite';
elseif ($packageid == 2)
$ribbon = 'ribbon-premium';
elseif ($packageid == 3)
$ribbon = 'ribbon-luxury';
for($j = 0; $j < $packageid; $j++) {
echo(' <img src="../img/'.$ribbon.'.png" class="small-icon"> ');
}
?>
</div>
<div class="col-md-12">
<a href="info.php?i=<?php echo($rowProduct['productid']) ?>">
<img src="../img/uploads/<?php echo($rowProduct['photosrc']) ?>" class="img-responsive clinic">
<img src="../img/shadow-bottom.png" class="img-responsive">
</a>
</div>
</div>
<?php
$i = $i + 1;
if($i >= 3) {
echo('<div class="col-md-12"></div>');
$i = 0;
}
} ?>
</div>
</div>
<div class="row">
<div class="col-md-12 spacer">
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#my-modal').modal('show');
});
</script>
<script src="js/back_button.js"></script>
<script src="../_lib/v/jquery.slim.min.js"></script>
<script src="../_lib/v/bootstrap/js/bootstrap.min.js"></script>
<script src="../_lib/v/jquery-ui/jquery-ui.js"></script>
<script src="../_lib/v/jscolor/jscolor.js"></script>
</body>
</html>
用于访问同一组件中的第二个功能。
有人遇到任何此类问题吗?如果是的话,该如何纠正?
已编辑:
一些参考代码:
component1.component.ts
404 not found
component2.component.ts
getallprojectcat()
{
this.authenticationService.getprojectcat()
.pipe(first())
.subscribe(
data => {
this.data = data;
},
error => {
this.loading = false;
});
}
}
.service文件
showprojects(moid)
{
this.authenticationService.getprojectslist(moid)
.pipe(first())
.subscribe(
data => {
this.silver = data;
},
error => {
console.log('some error');
this.alertService.error(error);
this.loading = false;
});
}
后端.js文件
getprojectcat()
{
return this.http.get<any>(this.studenturl+'/getprojectcata/')
.pipe(map(allprojectcat => {
console.log(JSON.stringify(allprojectcat));
return allprojectcat;
}));
}
getprojectslist(moid)
{
return this.http.get(this.studenturl+'/getprojects/'+moid)
.pipe(map(projectslist => {
console.log("Projects List:"+JSON.stringify(projectslist));
return projectslist;
})).catch(this.handleError);
}
函数getprojectcata在第一个组件中运行。但是,它显示了在第二个组件的getprojects函数上找不到的404。我检查了以下内容-
路由似乎不是问题,因为它可以毫无问题地移至下一个组件。
我们还尝试了通过组件中的同一服务调用getprojectscata,并且它可以正常工作。