我正在编写一个队列触发的蔚蓝函数:
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<form method="POST">
<input type="text" name="Locatie" placeholder="Locatie">
<input type="text" name="postcode" placeholder="postcode">
<input type="submit" name="submit" value="Toevoegen">
</form>
</body>
</html>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "skdb";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if (isset($_POST['submit']))
{
$Locatie = mysqli_real_escape_string($conn, $_REQUEST['Locatie']);
$postcode = mysqli_real_escape_string($conn, $_REQUEST['postcode']);
$sql = "INSERT INTO plaats (Locatie, postcode)
VALUES ('$Locatie', '$postcode')";
if ($conn->query($sql) === TRUE) {
echo "Deze locatie is succesvol toegevoegd";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
$conn->close();
?>
队列的名称为 [FunctionName("OnTranslationEventQueueTriggered")]
public static void Run([QueueTrigger("translationsqueue", Connection = "TranslationsQueueConnectionString")]string myQueueItem, ILogger log)
{
log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");
}
,但我希望能够对其进行参数化。
我们如何从配置中提取队列的名称?
答案 0 :(得分:3)
基于Binding expressions and patterns,应用程序设置绑定表达式以百分号包装,请参见以下示例:
在班上:
QueueTrigger("%translationsqueue%", …)
在绑定中:
{
"bindings": [
{
"name": "myQueueItem",
"type": "queueTrigger",
"direction": "in",
"queueName": "%translationsqueue%",
"connection": "TranslationsQueueConnectionString"
}
]
}