您好请求帮助我在flash builder 4中使用httpservice作为登录系统,但是我从服务器获取原始php未处理数据的结果,但是当我在浏览器中运行相同的文件时,我得到一个正确的xml文件使用MAMP , 请帮助donno这里的问题是php代码:
<?php
define( "DATABASE_SERVER", "localhost:8888" );
define( "DATABASE_USERNAME", "root" );
define( "DATABASE_PASSWORD", "root" );
define( "DATABASE_NAME", "touch" );
//connect to the database
$mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD) or die(mysql_error());
//select the database
mysql_select_db( DATABASE_NAME );
//These are the variables that Flex is passing to PHP
$username = mysql_real_escape_string($_POST["username"]);
$password = mysql_real_escape_string($_POST["password"]);
$logincookie = mysql_real_escape_string($_POST["logincookie"]);
//Check the credentials
$query = "SELECT * FROM users WHERE username = '$username' AND password = '$password'";
$result = mysql_fetch_array(mysql_query($query));
//Output the returned query in XML: If returned false output 0 else output the users id
$output = "<?xml version='1.0' encoding='utf-8'?>";
$output .= "<loginsuccess>";
if(!$result)
{
$output .= $username;
}else{
$output .= $username;
}
$output .= "</loginsuccess>";
//Output the User Type
$usrtyp .= "<usertype>";
$usrtyp .= $result['user_type'];
$usrtyp .= "</usertype>";
//output all the XML
print ($output);
print ($usrtyp);
?>
这是请求:
<s:HTTPService id="login_user" result="checkLogin(event)" showBusyCursor="true" method="POST"
url="login.php" useProxy="false">
<s:request xmlns="">
<username>
{username.text}
</username>
<password>
{password.text}
</password>
</s:request>
</s:HTTPService>
答案 0 :(得分:1)
我猜测你不是在HTTP服务器上运行它,而只是在文件系统上引用html / swf文件本身,因此PHP没有被处理。