深圳全飞鸿
标题:
关于XAJAX_FUNCTION
[打印本页]
作者:
zhgc
时间:
2020-2-6 21:33
标题:
关于XAJAX_FUNCTION
关于XAJAX_FUNCTION
代码:
$reqShowOutput =& $xajax->register(XAJAX_FUNCTION, "showOutput");
复制代码
返回的是:var_dump($reqShowOutput);
object(xajaxRequest)#13 (3) {
["sName"]=>
string(16) "xajax_showOutput"
["sQuoteCharacter"]=>
string(1) """
["aParameters"]=>
array(0) {
}
}
复制代码
作者:
zhgc
时间:
2020-2-6 22:48
代码:
function callScript( )
{
$response=new xajaxResponse();
$value2="this is a string";
$response->call( "myJSFunction", "arg1", 9432.12, array
(
"myKey" => "some value",
"key2" => $value2
));
return $response;
}
复制代码
monitor80过程:
POST /xajax/tests/callScriptTest.php HTTP/1.1
Host: 192.168.21.128
Connection: keep-alive
Content-Length: 36
Cache-Control: max-age=0
Origin: http://192.168.21.128
If-Modified-Since: Sat, 1 Jan 2000 00:00:00 GMT
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
content-type: application/x-www-form-urlencoded
Accept: */*
Referer: http://192.168.21.128/xajax/tests/callScriptTest.php
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
xjxfun=callScript&xjxr=1580999591996
复制代码
返回:
HTTP/1.1 200 OK
Date: Thu, 06 Feb 2020 14:33:12 GMT
Server: Apache/2.4.27 (Win32) PHP/5.6.31
X-Powered-By: PHP/5.6.31
Content-Length: 287
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/xml ; charset="utf-8"
<?xml version="1.0" encoding="utf-8" ?>
<xjx><cmd cmd="jc" func="myJSFunction">
<xjxobj>
<e><k>N0</k><v>Sarg1</v></e>
<e><k>N1</k><v>N9432.12</v></e>
<e><k>N2</k><v>
<xjxobj>
<e><k>SmyKey</k><v>Ssome value</v></e>
<e><k>Skey2</k><v>Sthis is a string</v></e>
</xjxobj></v>
</e>
</xjxobj>
</cmd></xjx>
复制代码
作者:
zhgc
时间:
2020-2-6 23:03
代码:
function showOutput()
{
$objResponse = new xajaxResponse();
$objResponse->assign("submittedDiv", "innerHTML", "123"); //$testResponseOutput);
return $objResponse;
}
复制代码
POST /xajax/tests/basicPluginTest.php HTTP/1.1
xjxfun=showOutput&xjxr=1581000981107
复制代码
<?xml version="1.0" encoding="utf-8" ?>
<xjx>
<cmd cmd="as" id="submittedDiv" prop="innerHTML">S123321</cmd>
</xjx>
复制代码
作者:
zhgc
时间:
2020-2-6 23:56
class testPlugin extends xajaxResponsePlugin
{
...
function testMethod()
{
$this->addCommand(array('n'=>'testPlg'), 'abcde]]>fg');
}
}
$objPluginManager = &xajaxPluginManager::getInstance();
$objPluginManager->registerPlugin(new testPlugin());
...
$objResponse->plugin('testPlugin', 'testMethod');
复制代码
得到了什么》》
<cmd n="testPlg" plg="testPlugin"><![CDATA[Sabcde]]]]><![CDATA[>fg]]></cmd>
欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/)
Powered by Discuz! X3.2