0
$params = [
':x1' => $locationBox['leftLongitude'],
':y1' => $locationBox['topLatitude'],
':x2' => $locationBox['rightLongitude'],
':y2' => $locationBox['topLatitude'],
':x3' => $locationBox['rightLongitude'],
':y3' => $locationBox['bottomLatitude'],
':x4' => $locationBox['leftLongitude'],
':y4' => $locationBox['bottomLatitude'],
':x5' => $locationBox['leftLongitude'],
':y5' => $locationBox['topLatitude']
];
$sql = "
....
INNER JOIN tag_geo T3 ON (T3.id = T2.tag_id_b AND ST_Covers(ST_GeogFromText('POLYGON((:x1 :y1, :x2 :y2, :x3 :y3, :x4 :y4, :x5 :y5))'), T3.geo_location));
";
$connection = \Yii::$app->getDb();
$command = $connection->createCommand($sql);
$command->bindValues($params);
$result = $command->queryAll();
내가 오류가 따옴표로 감싸 매개 변수를 평가하는 데 실패 준비), POLYGON 함수를 감싸는 틱을 제거하면이 POLYGON이 작은 따옴표 안에 있어야하므로 매개 변수가 평가되지만 다른 오류가 발생합니다.Yii2는 문을
작동하지만 작은 따옴표 나 두 따옴표는 제거해야합니다. 'POLYGON ((% s % s, % s % s, % s % s, % s % s, % s % s))' –
테스트를 마쳤습니다! 그렇습니다. –
그래서, 당신이 말한대로입니까? 작은 따옴표를 제거해야합니까? –