gpt4 book ai didi

php - Channel.Connect.Failed 错误 NetConnection.Call.BadVersion

转载 作者:行者123 更新时间:2023-11-29 00:54:35 26 4
gpt4 key购买 nike

好的 - 所以我一直在寻找所有地方来尝试纠正这个问题 - 但我一直在寻找不同的答案,坦率地说,试图弄清楚这个问题变得非常令人沮丧。让我发布一些代码供您查看:

PHP 脚本:

public function addNewCompany(CompanyVO $item) 
{
$stmt = mysqli_prepare($this->connection,
"INSERT INTO `companies` ('companyName') VALUES (?);");
$this->throwExceptionOnError();

mysqli_bind_param($stmt, 's', $item->companyName);
$this->throwExceptionOnError();

mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();

$autoid = mysqli_stmt_insert_id($stmt);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $autoid;
}

MXML 主应用的部分:

protected function companysignupsheet1_addCompanyEventHandler(event:AddCompanyEvent):void
{
companyservicero.addNewCompany({Data:event.companyData});
}

<s:RemoteObject id="companyservicero"
source="CompanyServices"
destination="addNewCompany"
endpoint = "http://localhost/PHP_RO/public/gateway.php"
result="companyservicero_resultHandler(event)"
fault="companyservicero_faultHandler(event)"/>

组件的部分代码:

            protected function button_submitNewCompany_clickHandler(event:MouseEvent):void
{
var companyData11:CompanyVO = new CompanyVO();
companyData11.companyName = textinput_NewCompanyName.text;

var eventObject:AddCompanyEvent = new AddCompanyEvent("addCompanyEvent", companyData11);
dispatchEvent(eventObject);
}

事件:

     package events
{
import flash.events.Event;


import valueObjects.CompanyVO;

public class AddCompanyEvent extends Event
{

public var companyData:CompanyVO;

public function AddCompanyEvent(type:String, companyData:CompanyVO)
{
super(type);
this.companyData = companyData;
}
}
}

如果我需要发布更多内容,我会很乐意这样做。另外 - 我知道尝试以这种方式发送一个文本值有点矫枉过正,但是当我让它工作时会有很多很多 - 我只是想专注于哪里问题是。哦 - 我不知道它是否有帮助......但目前我可以从附加到的 mySQL 数据库中检索记录(虽然我不是通过 RemoteObject 方式这样做) - 我也可以添加到相同的使用上面 PHP 的精确副本的旧拖放(连接到数据/服务)功能的表格(尽管信息硬编码在 (I.E. the CompanyName=testtest) 中)。

为了完成这一切——早些时候我没有为参数定义数据类型:

public function addNewCompany($item){.....

对于 addNewCompany - 它确实在数据库中添加了一条记录,尽管它是空白的并且它仍然会弹出一条包含整个 Channel.Connect 等的错误消息......现在在 Zend Server 的日志中它说数据在 stdClass 包装器中传输,并且在 CompanyVO 数据类型中需要它。

我对这一切感到非常沮丧 - 我已经被这类问题困扰了大约 2-3 天,我放弃了!请帮忙。非常感谢您的时间和帮助!

-CS

编辑 - 更多信息

网关.PHP

<?php
ini_set("display_errors", 1);
$dir = dirname(__FILE__);
$webroot = $_SERVER['DOCUMENT_ROOT'];
$configfile = "$dir/amf_config.ini";
$servicesdir = $dir.'/../services';
$librarydir = $dir.'/../library';
//default zend install directory
$zenddir = $webroot.'/ZendFramework/library';
//Load ini file and locate zend directory
if (file_exists($configfile)) {
$arr = parse_ini_file($configfile, true);
if (isset($arr['zend']['webroot'])) {
$webroot = $arr['zend']['webroot'];
$zenddir = $webroot.'/ZendFramework/library';
}
if (isset($arr['zend']['zend_path'])) {
$zenddir = $arr['zend']['zend_path'];
}
if (isset($arr['zend']['library'])) {
$librarydir = $arr['zend']['library'];
}
if (isset($arr['zend']['services'])) {
$servicesdir = $arr['zend']['services'];
}
}
// Setup include path
// add zend directory, library and services to include path
set_include_path(get_include_path()
.PATH_SEPARATOR.$zenddir
.PATH_SEPARATOR.$librarydir
.PATH_SEPARATOR.$servicesdir);
// Initialize Zend Framework loader
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true)- >suppressNotFoundWarnings(true);
// Load configuration
$default_config = new Zend_Config(array("production" => false), true);
$default_config->merge(new Zend_Config_Ini($configfile, 'zendamf'));
$default_config->setReadOnly();
$amf = $default_config->amf;
// Store configuration in the registry
Zend_Registry::set("amf-config", $amf);
// Initialize AMF Server
$server = new Zend_Amf_Server();
$server->setProduction($amf->production);
if (isset($amf->directories)) {
$dirs = $amf->directories->toArray();
foreach ($dirs as $dir) {
if ($dir == "./") {
$server->addDirectory($webroot);
} else
if (realpath("{$webroot}/{$dir}")) {
$server->addDirectory("{$webroot}/{$dir}");
} else
if (realpath($dir)) {
$server->addDirectory(realpath($dir));
}
}
}
// Initialize introspector for non-production
if (! $amf->production) {
$server->setClass('Zend_Amf_Adobe_Introspector', '',
array("config" => $default_config, "server" => $server));
$server->setClass('Zend_Amf_Adobe_DbInspector', '',
array("config" => $default_config, "server" => $server));
}
// Handle request
echo $server->handle();

AMF_CONFIG

[zend]
;set the absolute location path of webroot directory, example:
;Windows: C:\apache\www
;MAC/UNIX: /user/apache/www
webroot = "C:/Zend/Apache2/htdocs"

;set the absolute location path of zend installation directory, example:
;Windows: C:\apache\PHPFrameworks\ZendFramework\library
;MAC/UNIX: /user/apache/PHPFrameworks/ZendFramework/library
zend_path ="C:/Zend/Apache2/htdocs/.metadata/.plugins/org.zend.php.framework.resource/resources/ZendFramework-1/library"
library ="C:/Zend/Apache2/htdocs/PHP_RO/library"
services ="C:/Zend/Apache2/htdocs/PHP_RO/services"

[zendamf]
amf.production = false
amf.directories[]=PHP_RO/services

最佳答案

Channel.Connect.Failed 错误 NetConnection.Call.BadVersion 通常在 PHP 向 amf 响应回显错误或警告时发生。 Flex 收到一条 amf 消息,附加了诸如“警告 X 行出现错误”之类的内容,但无法解析它。打开 Flash Builder 中的网络监视器并查看最新的原始响应。您将看到带有 html 标记格式的错误。

关于php - Channel.Connect.Failed 错误 NetConnection.Call.BadVersion,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6716693/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com