flex 和php 通信
php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>flex login</title>
</head>
<body>
<?php
$return="";
if(isset($_POST[username]) && isset($_POST[userpwd])){
if ("User"==$_POST[username] && "123456"==$_POST[userpwd])
$return="ok";
else
$return="error";
}
$xml_return = '<users>';
$xml_return.= '<a>'.$return.'</a>';
$xml_return.= '</users>';
echo $xml_return;
?>
</body>
</html>
Flex:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
horizontalAlign="center"
verticalAlign="middle">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
private function goLogin():void
{
login.send();
}
private function resultHandler(event:ResultEvent):void
{
Alert.show(event.result.html.body.users.a.toString());
}
]]>
</mx:Script>
<mx:HTTPService id="login"
method="POST"
showBusyCursor="true"
url="http
相关文档:
flex整合spring也有很多的例子,其实有很多例子很复杂。我在这就给大家介绍个最简单的,很实用。
说明下:flex完全可以代替struts,下面的例子能证明。有人会问了,和其他框架怎么样整合。spring都能整合了,其他框架你要不会整合我也都无语了。
不多说了,看代码就知道简单不!
flex--sdk 3.2以上
jdk 1.5 以上
spring ......
试用了一下Flex,创建HelloWorld应用的顺序如下:
1 创建文件: HelloWorld-app.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://ns.adobe.com/air/application/1.5">
<id>com.kdevn.flex.HelloWorld</id>
<version&g ......
/*
author: yangyu@sina.cn
description: 交换数组中两个元素的位置,元素包括key和value,具体用法见下面的例子
*/
$arr = array(11=>'a',22=>'b',33=>'c',44=>'d');
$res = array_exchange($arr, 11 ,33);
//example:
echo '<pre>';print_r ($res);echo '</pre>';
function array_excha ......
Memcache函数库是在 PECL(PHP Extension Community Library)中,主要作用是搭建大容量的内存数据的临时存放区域,在分布式的时候作用体现的非常明显,否则不建议使用。
Memcache Win32 的安装和PHP中的配置
下载:Memcache Win32
www.php100.com www.jehiah.cz/projects/memcached-win32/
1、解压到目录: ......