【发布时间】:2017-07-09 12:09:06
【问题描述】:
刚刚从https://github.com/consolibyte/quickbooks-php 下载了最新文件并在 localhost 上进行了设置,并在 QuickBooks 桌面上完美运行了 Web 连接器示例,但是当上传到服务器时,即使示例表单也没有运行抛出错误,请查看以下表单。
https://qbdesktop.1dash.com/consus/webconnector/form.php
抛出以下消息。
警告:array_merge():参数 #2 不是 consus/QuickBooks/Utilities.php 第 54 行中的数组
注意:未定义索引:传入 consus/QuickBooks/Utilities.php 第 57 行
警告:require_once(consus/QuickBooks/Driver/.php): 无法打开流:中没有这样的文件或目录 consus/QuickBooks/Loader.php 第 56 行
致命错误:require_once():需要打开失败 'consus/QuickBooks/Driver/.php' (include_path='.:/usr/share/pear:/usr/share/php:/var/www/html/consus') 在 consus/QuickBooks/Loader.php 第 56 行
以下是config.php中的代码
<?php
// We need to make sure the correct timezone is set, or some PHP installations will complain
if (function_exists('date_default_timezone_set'))
{
// * MAKE SURE YOU SET THIS TO THE CORRECT TIMEZONE! *
// List of valid timezones is here: http://us3.php.net/manual/en/timezones.php
date_default_timezone_set('America/New_York');
}
// I always program in E_STRICT error mode...
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL | E_STRICT);
// Require the framework
require_once dirname(__FILE__) . '/../QuickBooks.php';
// Your .QWC file username/password
$qbwc_user = 'quickbooks';
$qbwc_pass = 'password';
// * MAKE SURE YOU CHANGE THE DATABASE CONNECTION STRING BELOW TO A VALID MYSQL USERNAME/PASSWORD/HOSTNAME *
//$dsn = 'mysql://root@localhost/1dashnew';
$dsn = 'mysql://user:password@server.amazonaws.com:3306/dbname';
if (!QuickBooks_Utilities::initialized($dsn))
{
// Initialize creates the neccessary database schema for queueing up requests and logging
QuickBooks_Utilities::initialize($dsn);
// This creates a username and password which is used by the Web Connector to authenticate
QuickBooks_Utilities::createUser($dsn, $qbwc_user, $qbwc_pass);
$Queue = new QuickBooks_WebConnector_Queue($dsn);
// Create our test table
mysql_query("CREATE TABLE my_customer_table (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
name varchar(64) NOT NULL,
fname varchar(64) NOT NULL,
lname varchar(64) NOT NULL,
quickbooks_listid varchar(255) DEFAULT NULL,
quickbooks_editsequence varchar(255) DEFAULT NULL,
quickbooks_errnum varchar(255) DEFAULT NULL,
quickbooks_errmsg varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM");
}
在 handler.php 中
<?php
/**
* Require some configuration stuff
*/
require_once dirname(__FILE__) . '/config.php';
// Handle the form post
if (isset($_POST['submitted']))
{
// Save the record
mysql_query("
INSERT INTO
my_customer_table
(
name,
fname,
lname
) VALUES (
'" . mysql_escape_string($_POST['name']) . "',
'" . mysql_escape_string($_POST['fname']) . "',
'" . mysql_escape_string($_POST['lname']) . "'
)");
// Get the primary key of the new record
$id = mysql_insert_id();
// Queue up the customer add
$Queue = new QuickBooks_WebConnector_Queue($dsn);
$Queue->enqueue(QUICKBOOKS_ADD_CUSTOMER, $id);
die('Great, queued up a customer!');
}
【问题讨论】:
-
发布您的代码。特别是你的 $dsn 字符串。
-
代码已添加,请帮我解决
标签: php sdk quickbooks require-once