我正在尝试获取页面的特色图像alt并将其作为段落文本回显,但我的代码似乎不起作用.
我现在能够回应图像并且它工作得很好.
这是我正在使用的代码:
<?php
get_header(); ?>
</div>
<?php /* The loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="header-image">
<?php echo get_the_post_thumbnail($page->ID, 'full'); ?>
<?php $alt = get_post_meta( $attachment_img->ID, '_wp_attachment_image_alt', true ); ?>
<p><?php echo $alt; ?></p>
</div>
Run Code Online (Sandbox Code Playgroud) 更新:我有一个简单的PHP表单,应该将数据提交到电子邮件地址但不发送它.它只是发送字段名称.
这是代码:
<?php
$ToEmail = 'email@yahoo.com';
$EmailSubject = 'Site contact form';
$mailheader = "From: ".$_POST["email"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
$mailheader .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$MESSAGE_BODY = "Name: ".$_POST["name"]."\r\n";
$MESSAGE_BODY .= "Surname: ".$_POST["surname"]."\r\n";
$MESSAGE_BODY .= "Designation: ".$_POST["designation"]."\r\n";
$MESSAGE_BODY .= "Phone: ".nl2br($_POST["phone"])."\r\n";
$MESSAGE_BODY .= "Email: ".nl2br($_POST["email"])."\r\n";
$MESSAGE_BODY .= "Opt in: ".nl2br($_POST["send"])."\r\n";
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");
?>
<form class="form-signin" name="index" action="index.php" method="post">
<img src="img/coffee.png" width="235" height="227">
<h2 class="form-signin-heading">Enter your information</h2>
<input name="name" type="text" class="input-block-level" id="name" placeholder="Name">
<input type="text" class="input-block-level" name="surname" …Run Code Online (Sandbox Code Playgroud)