Hello编程的怪物。我只是想问一个关于使用private async void List2_Dropped(object sender, DragEventArgs e)
{
if (e.DataView.Contains(StandardDataFormats.Text))
{
var def = e.GetDeferral();
var s = await e.DataView.GetTextAsync();
var ids = s.Split('\n');
if (ids.Length > 0)
{
foreach (string id in ids)
{
// get the object for the ID here
}
}
e.AcceptedOperation = DataPackageOperation.Copy;
def.Complete();
}
}
和$_SESSION
的问题。何时使用$_GET
和$_GET
?传递变量最好的是什么?我只是php和html的新手,我不知道什么是最佳做法。有人可以帮我理解这两个吗?
以下是我的代码示例。我使用$_SESSION
传递变量$_SESSION
这是edit.php
$newsid;
这是edit2.php
<?php
session_start();
include_once('connection.php');
$sql ="SELECT * FROM news ORDER BY news_id";
$result = mysqli_query($con, $sql);
while($row = mysqli_fetch_array($result)){
$newsid = $row['news_id'];
$title = $row['news_title'];
$date = $row['news_date'];
$content = $row['news_content'];
$newsimage = $row['news_image'];
?>
<div class="fix single_news">
<div class="single_image">
<img src="<?php echo $newsimage; ?>" style="width:200px; height:140px; alt="court">
</div>
<a href="#"><?php echo $title; ?></a>
<p><?php echo $date; ?></p>
<p><?php echo $content; ?></p>
</div>
<form action="" method="post">
<input type='hidden' name="news_id" value="<?php echo $newsid;?>">
<input type="submit" name="esubmit" value="edit" />
</form>
<hr>
<?php
}
if(isset($_POST['esubmit'])){
$_SESSION['news_id'] = $_POST['news_id'];
header('Location: edit2.php');
}
?>