springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-19 13:59:56
245
我使用HTML和PH PHP来计算正常单位
<html>
<head>
<title> Comprehensive FORM CGI program </title>
</head>
<body bgcolor=#DDDDDD>
<p>
<!-- The lines above are the standard html header -->
<?php
// First get the input variables and their values
$A = $_POST['f_A'];
$B = $_POST['f_B'];
$Acomponent = explode(",", $A);
$Bcomponent = explode(",", $B);
$AX = (int)$Acomponent[0];
$AY = (int)$Acomponent[1];
$AZ = (int)$Acomponent[2];
$BX = (int)$Bcomponent[0];
$BY = (int)$Bcomponent[1];
$BZ = (int)$Bcomponent[2];
function dot_product($AX, $AY, $AZ, $BX, $BY, $BZ){
$dotproduct = ($AX*$BX+$AY*$BY+$AZ*$BZ);
return($dotproduct);
}
function cross_product($AX, $AY, $AZ, $BX, $BY, $BZ){
$i = ($AY*$BZ-$AZ*$BY);
$j = (-1)*($AX*$BZ-$AZ*$BX);
$k = ($AX*$BY-$AY*$BX);
return($i);
return($j);
return($k);
}
function norm($AX, $AY, $AZ, $BX, $BY, $BZ) {
$Anorm=sqrt(pow($AX,2)+pow($AY,2)+ pow($AZ,2));
$Bnorm=sqrt(pow($BX,2)+pow($BY,2)+ pow($BZ,2));
return($Anorm);
return($Bnorm);
}
function anglebetween($dotproduct,$Anorm, $Bnorm) {
$angle = acos($dotproduct/($Anorm*$Bnorm));
return($angle);
}
function normalunitvector($i,$j,$k) {
$crossnorm=sqrt(pow($i,2)+pow($j,2)+ pow($k,2));
$normaluniti = $i/$crossnorm;
$normalunitj = $j/$crossnorm;
$normalunitk = $k/$crossnorm;
$normalunit = [];
$normalunit[0] = $normaluniti;
$normalunit[1] = $normalunitj;
$normalunit[2] = $normalunitk;
return($normalunit);
}
dot_product($AX, $AY, $AZ, $BX, $BY, $BZ);
cross_product($AX, $AY, $AZ, $BX, $BY, $BZ);
norm($AX, $AY, $AZ, $BX, $BY, $BZ);
anglebetween($dotproduct,$Anorm, $Bnorm);
normalunitvector($i,$j,$k);
echo($angle);
echo($normaluniti);
echo($normalunitj);
echo($normalunitk);
?>
<p>
<hr>
<p>
</body>
</html>
AX、AY、AZ、BX、BY、BZ值打印良好,而angle、normaluniti、normalunij、normalunitk值打印不良
我不知道为什么,但我猜我的函数中有一个错误?
<html>
<head>
<title> Comprehensive FORM CGI program </title>
</head>
<body bgcolor=#DDDDDD>
<p>
<!-- The lines above are the standard html header -->
<?php
// First get the input variables and their values
$A = $_POST['f_A'];
$B = $_POST['f_B'];
$Acomponent = explode(",", $A);
$Bcomponent = explode(",", $B);
$AX = (int)$Acomponent[0];
$AY = (int)$Acomponent[1];
$AZ = (int)$Acomponent[2];
$BX = (int)$Bcomponent[0];
$BY = (int)$Bcomponent[1];
$BZ = (int)$Bcomponent[2];
function dot_product($AX, $AY, $AZ, $BX, $BY, $BZ){
$dotproduct = ($AX*$BX+$AY*$BY+$AZ*$BZ);
return($dotproduct);
}
function cross_product($AX, $AY, $AZ, $BX, $BY, $BZ){
$i = ($AY*$BZ-$AZ*$BY);
$j = (-1)*($AX*$BZ-$AZ*$BX);
$k = ($AX*$BY-$AY*$BX);
return($i);
return($j);
return($k);
}
function norm($AX, $AY, $AZ, $BX, $BY, $BZ) {
$Anorm=sqrt(pow($AX,2)+pow($AY,2)+ pow($AZ,2));
$Bnorm=sqrt(pow($BX,2)+pow($BY,2)+ pow($BZ,2));
return($Anorm);
return($Bnorm);
}
function anglebetween($dotproduct,$Anorm, $Bnorm) {
$angle = acos($dotproduct/($Anorm*$Bnorm));
return($angle);
}
function normalunitvector($i,$j,$k) {
$crossnorm=sqrt(pow($i,2)+pow($j,2)+ pow($k,2));
$normaluniti = $i/$crossnorm;
$normalunitj = $j/$crossnorm;
$normalunitk = $k/$crossnorm;
$normalunit = [];
$normalunit[0] = $normaluniti;
$normalunit[1] = $normalunitj;
$normalunit[2] = $normalunitk;
return($normalunit);
}
dot_product($AX, $AY, $AZ, $BX, $BY, $BZ);
cross_product($AX, $AY, $AZ, $BX, $BY, $BZ);
norm($AX, $AY, $AZ, $BX, $BY, $BZ);
anglebetween($dotproduct,$Anorm, $Bnorm);
normalunitvector($i,$j,$k);
echo($angle);
echo($normaluniti);
echo($normalunitj);
echo($normalunitk);
?>
<p>
<hr>
<p>
</body>
</html>
没有显示任何东西。如何解决此问题?
顺晟科技:
因此,请在下面找到一个工作示例:
(为了测试,我添加了两行代码来赋值$A和$B,如果要应用$_POST的值,请删除它们)
<html>
<head>
<title> Comprehensive FORM CGI program </title>
</head>
<body bgcolor=#DDDDDD>
<p>
<!-- The lines above are the standard html header -->
<?php
// First get the input variables and their values
$A = $_POST['f_A'];
$B = $_POST['f_B'];
$Acomponent = explode(",", $A);
$Bcomponent = explode(",", $B);
$AX = (int)$Acomponent[0];
$AY = (int)$Acomponent[1];
$AZ = (int)$Acomponent[2];
$BX = (int)$Bcomponent[0];
$BY = (int)$Bcomponent[1];
$BZ = (int)$Bcomponent[2];
function dot_product($AX, $AY, $AZ, $BX, $BY, $BZ){
$dotproduct = ($AX*$BX+$AY*$BY+$AZ*$BZ);
return($dotproduct);
}
function cross_product($AX, $AY, $AZ, $BX, $BY, $BZ){
$i = ($AY*$BZ-$AZ*$BY);
$j = (-1)*($AX*$BZ-$AZ*$BX);
$k = ($AX*$BY-$AY*$BX);
return($i);
return($j);
return($k);
}
function norm($AX, $AY, $AZ, $BX, $BY, $BZ) {
$Anorm=sqrt(pow($AX,2)+pow($AY,2)+ pow($AZ,2));
$Bnorm=sqrt(pow($BX,2)+pow($BY,2)+ pow($BZ,2));
return($Anorm);
return($Bnorm);
}
function anglebetween($dotproduct,$Anorm, $Bnorm) {
$angle = acos($dotproduct/($Anorm*$Bnorm));
return($angle);
}
function normalunitvector($i,$j,$k) {
$crossnorm=sqrt(pow($i,2)+pow($j,2)+ pow($k,2));
$normaluniti = $i/$crossnorm;
$normalunitj = $j/$crossnorm;
$normalunitk = $k/$crossnorm;
$normalunit = [];
$normalunit[0] = $normaluniti;
$normalunit[1] = $normalunitj;
$normalunit[2] = $normalunitk;
return($normalunit);
}
dot_product($AX, $AY, $AZ, $BX, $BY, $BZ);
cross_product($AX, $AY, $AZ, $BX, $BY, $BZ);
norm($AX, $AY, $AZ, $BX, $BY, $BZ);
anglebetween($dotproduct,$Anorm, $Bnorm);
normalunitvector($i,$j,$k);
echo($angle);
echo($normaluniti);
echo($normalunitj);
echo($normalunitk);
?>
<p>
<hr>
<p>
</body>
</html>
您将它们用作函数内部的局部变量。它们的生命周期在函数的括号之间开始和结束。
试着告诉我这是否有效。
如果是这样,则可以存储AngleBetween($dotproduct,$anorm,$bnorm);在变量中或仅调用函数。
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11