这可能看起来很简单,但我对此感到沮丧。我想在特定日期搜索所有发票
PicklingError: Can't pickle <type 'thread.lock'>: attribute lookup thread.lock failed
那些总是返回空结果。我哪里做错了?
答案 0 :(得分:0)
如果你正在使用yii 1试试这个。
$invoice_date ='2017-04-26 06:56:16';
$criteria = new CDbCriteria();
$criteria->condition = "invoice_date =:invoice_date";
$criteria->params = array(':invoice_date' => $invoice_date);
$invoices2 = SalesInvoice::model()->findAll($criteria);
OR
$invoices2 = SalesInvoice::model()->findAll(
array(
'condition' => 'invoice_date = :invoice_date',
'params' => array(':invoice_date' => '2017-04-26 06:56:16')
)
);
对于yii2
$invoices2 = SalesInvoice::findAll(['invoice_date' =>'2017-04-26 06:56:16']);
OR
$invoices2 = SalesInvoice::find()->where(['invoice_date' =>'2017-04-26 06:56:16'])->all();