Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP中的错误,内爆-[内部],行?_Php_Cakephp 2.1 - Fatal编程技术网

PHP中的错误,内爆-[内部],行?

PHP中的错误,内爆-[内部],行?,php,cakephp-2.1,Php,Cakephp 2.1,好的,让我从一开始就开始,我是一个新手,正在处理一个用cakephp 1.2编码的发票示例,并试图让它工作,但我使用的是cakephp 2.1和php 5。??这意味着一些代码与原来的代码不同,我正在努力找出它们,因为我一直在看这个错误3天,但没有找到任何地方,这就是为什么我要发送求救信号:) 私有方法 读了这里之后,我得到了一个错误操作数错误,这是因为我试图用一个字符串进行乘法和数组,或者这就是我想的,所以我将它改为下面的函数 # returns line item qty times pri

好的,让我从一开始就开始,我是一个新手,正在处理一个用cakephp 1.2编码的发票示例,并试图让它工作,但我使用的是cakephp 2.1和php 5。??这意味着一些代码与原来的代码不同,我正在努力找出它们,因为我一直在看这个错误3天,但没有找到任何地方,这就是为什么我要发送求救信号:)

私有方法 读了这里之后,我得到了一个错误操作数错误,这是因为我试图用一个字符串进行乘法和数组,或者这就是我想的,所以我将它改为下面的函数

# returns line item qty times price
function __lineItemTotal($qty, $price)
{
    
$arrayjoin = array_merge((array)$qty, (array)$price);
    return array_product($arrayjoin);
    settype($arrayjoin, "integer");
    print_r($arrayjoin);

}
现在我得到了另一个错误,当有一个十进制数作为价格选择,下面是通知代码和上下文

Notice (8): Array to string conversion [CORE/Cake/Model/Datasource/DboSource.php, line 1006]
 implode - [internal], line ??
DboSource::create() - CORE/Cake/Model/Datasource/DboSource.php, line 1006
Model::save() - CORE/Cake/Model/Model.php, line 1730
Model::saveMany() - CORE/Cake/Model/Model.php, line 2089
Model::saveAll() - CORE/Cake/Model/Model.php, line 2026
InvoicesController::add() - APP/Controller/InvoicesController.php, line 128
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 485
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 186
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 161
[main] - APP/webroot/index.php, line 92
代码:

背景:

$model = object(Item) {
displayField => 'name'
belongsTo => array(
    'Invoice' => array(
        [maximum depth reached]

    ),
    'Unit' => array(
        [maximum depth reached]
    )
)
useDbConfig => 'default'
useTable => 'items'
id => false
data => array(
    'Item' => array(
        [maximum depth reached]
    )
)
schemaName => 'invoicr'
table => 'items'
primaryKey => 'id'
validate => array()
validationErrors => array()
validationDomain => null
name => 'Item'
alias => 'Item'
tableToModel => array(
    'items' => 'Item',
    'units' => 'Unit'
)
cacheQueries => false
hasOne => array()
hasMany => array()
hasAndBelongsToMany => array()
actsAs => null
Behaviors => object(BehaviorCollection) {}
whitelist => array()
cacheSources => true
findQueryType => null
recursive => (int) 1
order => null
virtualFields => array()
__backAssociation => array()
__backInnerAssociation => array()
__backOriginalAssociation => array()
__backContainableAssociation => array()
findMethods => array(
    'all' => true,
    'first' => true,
    'count' => true,
    'neighbors' => true,
    'list' => true,
    'threaded' => true
)
Unit => object(Unit) {}
tablePrefix => ''

$fields = array(
(int) 0 => 'unit_id',
(int) 1 => 'qty',
(int) 2 => 'description',
(int) 3 => 'price',
(int) 4 => 'total',
(int) 5 => 'name',
(int) 6 => 'invoice_id'
)

$values = array(
(int) 0 => '1',
(int) 1 => array(
    (int) 0 => '55.00'
),
(int) 2 => array(
    (int) 0 => ' testing ="testing "'
),
(int) 3 => array(
    (int) 0 => '10.01'
),
(int) 4 => (float) 550.55,
(int) 5 => 'Service',
(int) 6 => '49'
)
$id = null
$count = (int) 7
$i = (int) 7
$valueInsert = array(
(int) 0 => '1',
(int) 1 => array(
    (int) 0 => '55.00'
),
(int) 2 => array(
    (int) 0 => '' testing =\"testing \"''
),
(int) 3 => array(
    (int) 0 => '10.01'
),
(int) 4 => '550.55',
(int) 5 => ''Service'',
(int) 6 => '49'
)
$fieldInsert = array(
(int) 0 => '`unit_id`',
(int) 1 => '`qty`',
(int) 2 => '`description`',
(int) 3 => '`price`',
(int) 4 => '`total`',
(int) 5 => '`name`',
(int) 6 => '`invoice_id`'
 )

 }
在看了几周之后,我发现保存mysql就是试图保存一个数组,这个集合在哪里

 Code:
 $valueInsert = array(
 (int) 0 => '1',
 (int) 1 => array(
 (int) 0 => '55.00'
 ),
 (int) 2 => array(
 (int) 0 => '' testing =\"testing \"''
  ),
   (int) 3 => array(
 (int) 0 => '10.01'
 ),
 (int) 4 => '550.55',
 (int) 5 => ''Service'',
 (int) 6 => '49'
 )
谢谢大家,希望能解决这个问题

干杯


Sarky

该错误可能是由
\u list
函数中的一个
find
调用引起的。你有没有一个接一个地试过这些电话,看看是否有任何一个会触发错误?这可能是因为您正在向
find
方法提供一组无效的参数,然后它尝试使用
内爆来转换这些参数。
        'table' => $this->fullTableName($model),
        'fields' => implode(', ', $fieldInsert),
        'values' => implode(', ', $valueInsert)
$model = object(Item) {
displayField => 'name'
belongsTo => array(
    'Invoice' => array(
        [maximum depth reached]

    ),
    'Unit' => array(
        [maximum depth reached]
    )
)
useDbConfig => 'default'
useTable => 'items'
id => false
data => array(
    'Item' => array(
        [maximum depth reached]
    )
)
schemaName => 'invoicr'
table => 'items'
primaryKey => 'id'
validate => array()
validationErrors => array()
validationDomain => null
name => 'Item'
alias => 'Item'
tableToModel => array(
    'items' => 'Item',
    'units' => 'Unit'
)
cacheQueries => false
hasOne => array()
hasMany => array()
hasAndBelongsToMany => array()
actsAs => null
Behaviors => object(BehaviorCollection) {}
whitelist => array()
cacheSources => true
findQueryType => null
recursive => (int) 1
order => null
virtualFields => array()
__backAssociation => array()
__backInnerAssociation => array()
__backOriginalAssociation => array()
__backContainableAssociation => array()
findMethods => array(
    'all' => true,
    'first' => true,
    'count' => true,
    'neighbors' => true,
    'list' => true,
    'threaded' => true
)
Unit => object(Unit) {}
tablePrefix => ''

$fields = array(
(int) 0 => 'unit_id',
(int) 1 => 'qty',
(int) 2 => 'description',
(int) 3 => 'price',
(int) 4 => 'total',
(int) 5 => 'name',
(int) 6 => 'invoice_id'
)

$values = array(
(int) 0 => '1',
(int) 1 => array(
    (int) 0 => '55.00'
),
(int) 2 => array(
    (int) 0 => ' testing ="testing "'
),
(int) 3 => array(
    (int) 0 => '10.01'
),
(int) 4 => (float) 550.55,
(int) 5 => 'Service',
(int) 6 => '49'
)
$id = null
$count = (int) 7
$i = (int) 7
$valueInsert = array(
(int) 0 => '1',
(int) 1 => array(
    (int) 0 => '55.00'
),
(int) 2 => array(
    (int) 0 => '' testing =\"testing \"''
),
(int) 3 => array(
    (int) 0 => '10.01'
),
(int) 4 => '550.55',
(int) 5 => ''Service'',
(int) 6 => '49'
)
$fieldInsert = array(
(int) 0 => '`unit_id`',
(int) 1 => '`qty`',
(int) 2 => '`description`',
(int) 3 => '`price`',
(int) 4 => '`total`',
(int) 5 => '`name`',
(int) 6 => '`invoice_id`'
 )

 }
 Code:
 $valueInsert = array(
 (int) 0 => '1',
 (int) 1 => array(
 (int) 0 => '55.00'
 ),
 (int) 2 => array(
 (int) 0 => '' testing =\"testing \"''
  ),
   (int) 3 => array(
 (int) 0 => '10.01'
 ),
 (int) 4 => '550.55',
 (int) 5 => ''Service'',
 (int) 6 => '49'
 )