当我从网络浏览器访问它时,它只会返回echo'd文本,我知道这与我发布的另一个问题类似,但我无法理解它?Web浏览器没有任何返回 - 函数错误?
<?php
include('config.php');
include('database.php');
class conversion{
public $amnt;
public $cc_from;
public $cc_to;
public function __construct(){
$this->amnt = htmlspecialchars($_GET["amnt"]);
$this->cc_from = htmlspecialchars($_GET["from"]);
$this->cc_to = htmlspecialchars($_GET["to"]);
}
function convert($this->amnt,$this->cc_from,$this-cc_to,$decimals=2){
$db_rate_from = mysql_query("SELECT * FROM _currency WHERE country_code='$this- >cc_from'") or die(mysql_error());;
$query_row_from = mysql_fetch_array($db_rate_from);
$rate_from = ($query_row_from['rate']);
echo $rate_from;
echo "</br>rate to</br>";
$db_rate_to = mysql_query("SELECT * FROM _currency WHERE country_code='$this->cc_to'") or die(mysql_error());;
$query_row_to = mysql_fetch_array($db_rate_to);
$rate_to = ($query_row_to['rate']);
echo $rate_to;
echo "</br>conversion</>";
$conversion = (number_format(($amnt/$rate_from)*$rate_to,$decimals));
echo $conversion;
} }
$var = new conversion();
$var->convert($amnt,$cc_from,$cc_to);
?>
好的SQL注入漏洞。使用htmlspecialchars来“安全”SQL数据就像使用卫生纸广场清理海洋。 – 2012-02-22 14:55:00
缩进你的代码可以提供帮助,仅仅在FYI之后。 – Ryan 2012-02-22 14:55:15
您的预期产出是多少?您的实际产出是多少? – 2012-02-22 14:55:52