當我按下插入按鈕到數據庫時,我不得不插入一些數據,並且我希望看到每一行,然後在一個0.5秒後div將消失。我知道代碼是錯誤的,只是爲了理解。Vuejs我如何淡出div
<?php
$contents = file_get_contents("foo.txt.001");
$pollfields = explode(',', $contents);
foreach ($pollfields as $key) {
$sql = "INSERT INTO keywords (`keys`) VALUES ('".$key."')";
if ($conn->query($sql) === TRUE) {
<div v-if="show" transition="fade" >
<div class="alert alert-success" role="alert">
<strong>$key</strong>
</div>
</div>
echo ;
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
?>
<script> new Vue({ el: '#demo', data: { show: true } }) </script>
這個CSS:
.fade-enter-active, .fade-leave-active {
transition: opacity .5s
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
opacity: 0
}
您的代碼易受[** SQL注入**](https://en.wikipedia.org/wiki/SQL_injection)攻擊。您應該通過[** mysqli **](https://secure.php.net/manual/en/mysqli.prepare.php)或[** PDO **](https ://secure.php.net/manual/en/pdo.prepared-statements.php)驅動程序。 [**這篇文章**](https://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php)有一些很好的例子。 –
我知道,但我如何淡化div vlue vue我想在短短0.5秒之後解開 –
你的vue代碼在哪裏? – apokryfos