php - 如何将php代码信息发送到外部链接
问题描述
我正在使用以下代码来定义我的数据库数据中包含的某些信息,并将它们发送到外部动态页面。我目前能够成功发送我拥有的 4 个数据中的 3 个。帖子标题(1)、剧情(2)、海报(3)无问题发送;而快照(4)给我带来了麻烦。
$send 变量是将数据带到外部动态页面的变量。我认为我在其中调用“快照”的方式做错了什么。
$post_title = get_the_title();
$theplot = get_post_meta($post->ID, 'book_plot', true);
$poster_id = get_post_thumbnail_id();
$poster_src = wp_get_attachment_image_src($poster_id,'medium', true);
snapshot($post_id) {
global $post;
$thumbnail_ID = get_post_thumbnail_id();
$images = get_children( array('post_parent' => $post_id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
if ($images) :
foreach ($images as $attachment_id => $image) :
if ( $image->ID != $thumbnail_ID ) :
$img_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true); //alt
if ($img_alt == '') : $img_alt = $image->post_title; endif;
$big_array = image_downsize( $image->ID, 'large' );
$img_url = $big_array[0];
echo $img_url;
endif; endforeach; endif; }
$send = 'http://mywebsite.com/show/?title='. urlencode($post_title) . '&plot='. urlencode($theplot) . '&image='. ($poster_src[0]) . '&snapshot='. (snapshot("$post->ID"));
解决方案
推荐阅读
- python - 从 Dataframe 中提取不同的值并将它们插入到具有相同列名的新 Dataframe 中
- python - 如何使列表中的列与列表中最长的字符串一样长?
- julia - 比较 Julia 中的 2 个数据帧是否相同
- perl - 从 perl DBI 执行中抑制 stderr
- amazon-web-services - 如何在 API 网关中设置 Stage 以使资源在不同阶段指向不同的 lambda
- flutter - Flutter bloc 模式结构问题(从 Ui Provider 发送表单数据)
- ios - 为什么没有调用发现外围设备?
- javascript - 为什么 JSX 中没有 if ?
- java - 如何在android中的相对布局上产生涟漪效应?
- git - 从远程的同一个分支更新我的本地分支