flash与php
p { margin-bottom: 0.08in; }
flash与 asp:
先把两个代码贴一下 :
flash:
网页教学网
var loader:URLLoader = new URLLoader();
var url:URLRequest = new URLRequest("test.asp");
url.method = URLRequestMethod.POST;
var values:URLVariables = new URLVariables();
values.message="hello im flash!";
url.data = values;
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE,loaded);
function loaded(e:Event) {
out1.text=loader.data;
//outPut: phpMessage=im php message!&flashMessage=hello im flash!
out2.text=loader.data.phpMessage;
// im php message!
out3.text=loader.data.flashMessage;
// hello im flash!
out4.text=loader.data.dbMessage;
}
loader.load(url);
网页教学网
网页教学网
asp:
Webjx.Com
//接收 flash传进来的数据
var flashData;
flashData = Request("message");
//发给 flash的数据
var aspMessage;
aspMessage = ’im asp message!’;
//数据库的相关操作
//======================================
var conn;
var rs;
var sql;
var strPath;
strPath="test.mdb";
try{
conn = Server.CreateObject("ADODB.Connection");
conn.connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(strPath);
conn.open();
}catch(e){
Response.Write(’
数据库连接出错,请检查连接字串 !
’);Response.End
}
rs=Server.createobject("ADODB.Recordset") ;
sql="select * from name" ;
rs.open(sql,conn,1,1);
//======================================
Response.Write("phpMessage="+aspMessage+"&"+"flashMessage="+flashData+"&"+"dbMessage="+rs("companyname"));
%>
Webjx.Com
看到 flash和 asp文件时面变量名就知道相互是怎么传送的呢 ,对于数据库的一些插入 ,更新 ,查询的操作 ,只要接收 flash的数据 ,直接运行 asp相关数据库操作命令就行了 .直接复制到 IIS的路径下即可测试 .在线观看地址 :PLETE,loaded);
function loaded(e:Event) {
out1.text=loader.data;
//outPut: phpMessage=im php message!&flashMessage=hello im flash!
out2.text=loader.data.phpMessage;
// im php message!
out3.text=loader.data.flashMessage; Webjx.Com
// hello im flash!
out4.text=loader.data.dbMessage;
}
loader.load(url);
php:
Webjx.Com
Webjx.Com
//这里都是有关数据库的操作
//===================================
Define(’DATABASE_SERVER’, ’localhost’);
Define(’DATABASE_USERNAME’, ’root’);
Define(’DATABASE_PASSWORD’, ’root’);
Define(’DATABASE_NAME’, ’flextest’);
$link=@mysql_connect(DATABASE_SERVER,DATABASE_USERNAME,DATABASE_PASSWORD);
@mysql_select_db(DATABASE_NAME,$link);
$result=@mysql_query("Select * from users");
$user=@mysql_fetch_array($result,MYSQL_ASSOC);
//echo $user[’userid’];
$dbvar=$user[’userid’];
//===================================
//接收 flash传进来的数据
$flashData = $_POST[’message’];
//给 flash发送的数据
$phpMessage = ’im php message!’;
echo "phpMessage=$phpMessage&flashMessage=$flashData&dbMessage=$dbvar";
?>
Webjx.Com
代码很简单 ,不用多解释 ,其实和 asp的没有多大区别的 .直接复制到 php的路径下即可测试 .数据库文件直接在 phpMyAdmin下面执行 flextest.sql里的 sql语句就行了 .因为公司禁端口 ,我不能在线操作我空间的 sql的数据库 ,在线演示地址就没有 ,等有时间在家里加上 .
Flex与 php:
先把两个代码贴一下 :
Flex:
Webjx.Com
Webjx.Com
<script> </script>
public function onInit():void
{
userRequest.send();
} Webjx.Com
]]>
Webjx.Com
php:
网页教学网
/* Thanks to Pete Mackie for the code below */
Define(’DATABASE_SERVER’, ’localhost’);
Define(’DATABASE_USERNAME’, ’root’);
Define(’DATABASE_PASSWORD’, ’root’);
Define(’DATABASE_NAME’, ’flextest’);
# Connect to the database
$mysqli = new mysqli(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME);
# Check connection
if (mysqli_connect_errno()) {
printf("MySQL connect failed: %s\n", mysqli_connect_error());
exit();
}
# Quote variable to make safe
function quote_smart($value) {
global $mysqli;
Webjx.Com
# Stripslashes
if (get_magic_quotes_gpc())
$value = stripslashes($value);
# Quote if not integer
if (!is_numeric($value))
$value = $mysqli->real_escape_string($value);
return $value;
}
if (!empty($_POST) && $_SERVER[’REQUEST_METHOD’] == ’POST’) {
if ($_POST[’emailaddress’] && $_POST[’username’]) { 网页教学网
# Add the user
$query = sprintf("Insert INTO users VALUES (’’, ’%s’, ’%s’)", quote_smart($_POST[’username’]), quote_smart($_POST[’emailaddress’]));
if (!@$mysqli->query($query)) {
printf("’flextest’ user database query insert error: %s\n", $mysqli->error);
$mysqli->close();
Webjx.Com
exit();
}
}
}
# Return a list of all the users
if (!$result=@$mysqli->query("Select * from users")) {
printf("’flextest’ user database query select error: %s\n", $mysqli->error);
$mysqli->close();
exit();
}
$xml_return = "
while ($user = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
$xml_return .= Webjx.Com
"
}
$xml_return.= "";
$mysqli->close();
echo $xml_return;
?>
这里的代码就是 Adobe phpria sdk里的一个实例 . 如果想要全部源码的请留下邮箱 ,我来发 .flex与 php的就不说了 ,直接把 php的代码化成 asp代码就行了 ,和 flash的一道理了 .

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics





Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Laravel's service container and service providers are fundamental to its architecture. This article explores service containers, details service provider creation, registration, and demonstrates practical usage with examples. We'll begin with an ove

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.
