我已经远程搜索网络以寻找解决此问题的方法.我已经知道Yii2下拉方式是这样的:
<?php
use yii\helpers\ArrayHelper;
use backend\models\Standard;
?>
<?= Html::activeDropDownList($model, 's_id',
ArrayHelper::map(Standard::find()->all(), 's_id', 'name')) ?>
Run Code Online (Sandbox Code Playgroud)
但我想在没有$model
......的情况下进行下拉...有没有办法做到这一点?
先感谢您!
如果我有以下数组$array[0] = array(
"1" => bar,
"2" => foo,
"3" => 13546
);
并且我内含()它,则返回的值将是:bar,foo,13546
不能在mysql查询中使用...如何将单引号仅放置到字符串的值...
我尝试了几种方法(比如foreach($array as $key=>$value)
检查is_numeric()$ value,检查没问题,但我不知道如何将值更改为'$ value'...)
对此有何不妥?
编辑
我发现另一种方法可以帮助那些感兴趣的人:
$result[0] = array(
"1" => bar,
"2" => foo,
"3" => 1232.13
);
$copy_r = $result[0];
foreach($copy_r as $key=>$value)
{
if(!is_numeric($value))
{
$insert_array[] = "`$key` = '$value'";
}
else
{
$insert_array[] = "`$key` = $value";
}
}
$final_string = implode(',', $insert_array);
$insert_q = "INSERT INTO `table_name` SET $final_string
ON DUPLICATE KEY UPDATE ($final_string)";
Run Code Online (Sandbox Code Playgroud) 我正在尝试将adyen api实现到我的项目中,我遇到了以下问题:
首先,我收到来自adyen的通知回调,其中AUTHORIZATION为true且传输状态为1,但在此之后,我没有收到任何其他通知.即使付款流程为CAPTURED为true,通知也不会到达.
我已经在adyen沙箱中测试了adyen通知,并且通知工作正常.以下是回调文件的代码示例:
if (($eventCode=="AUTHORISATION") && ($success=="true"))
{
if($paymentRecharge['status']!=0) //Check if status is placed only
{
ReleaseTableLock($orderID);
print('[accepted]');
return;
}
if (($paymentRecharge['adyen_amount']!=$value) || ($paymentRecharge['currency']!=$currency)) //Check to see if the paid value is the same as our value, otherwise this is Fraud
{
SetPaymentStatus($orderID,5);
ReleaseTableLock($orderID);
print('[accepted]');
return;
}
MarkAsAuthorised($orderID); //changes status to 1 - authorised
//check if we need to Capture automatically
if($adyenParams['adyen_capture']==1)
{
$adyen = new AdyenGateway();
$data = array();
$data["params"] = $adyenParams;
$data["userId"] = $paymentRecharge['customerId'];
$response;
$result=$adyen->Capture($data,$pspReference,$response,$paymentRecharge['userId'],$paymentRecharge['adyen_amount'],$paymentRecharge['currency']);
} …
Run Code Online (Sandbox Code Playgroud)