Php 映像刮取和备份问题

Php 映像刮取和备份问题,php,html,database,rows,Php,Html,Database,Rows,我的问题是: 我有一个脚本,刮一个网站的信息(经许可)。 结果可能导致空答案、链接或带有frase“N/a”字样 如果结果为空或不适用,我希望脚本打印指向no_image.png的实习生链接。但如果我的数据库行“poster”中确实有链接,我希望显示该链接,而不是刮取结果 如果scrape和my row海报都是空的och,我的scrape是N/An,我想显示no_image.png 下面是一段代码。。。是的。。我知道这完全是无稽之谈: if (!empty($row["poster"])){

我的问题是:

我有一个脚本,刮一个网站的信息(经许可)。 结果可能导致空答案、链接或带有frase“N/a”字样

如果结果为空或不适用,我希望脚本打印指向no_image.png的实习生链接。但如果我的数据库行“poster”中确实有链接,我希望显示该链接,而不是刮取结果

如果scrape和my row海报都是空的och,我的scrape是N/An,我想显示no_image.png

下面是一段代码。。。是的。。我知道这完全是无稽之谈:

if (!empty($row["poster"])){
    tr("Poster", "<object data='".$row["poster"]."height='250' width='200' align='left''title='object2' ><img src='".$image_dir."no_image.png'height='250' width='200' align='left' title='2'></object>", 1);

     }  else {
           tr("Poster", "<object data='".$row["scrape"]."'height='250' width='200' align='left' title='object1' ><img src='".$image_dir."no_image.png'height='250' width='200' align='left' title='1'></object>", 1);
}
if(!empty($row[“poster”])){
tr(“海报”,1);
}否则{
tr(“海报”,1);
}

也许它也像测试N/A一样简单

 if (!empty($row["poster"]) && $row["poster"]!='N/A'){
    tr("Poster", "<object data='".$row["poster"]."'height='250' width='200' align='left''title='object2' ><img src='".$image_dir."'no_image.png' height='250' width='200' align='left' title='2'></object>", 1);

     }  else {
           tr("Poster", "<object data='".$row["scrape"]."'height='250' width='200' align='left' title='object1' ><img src='".$image_dir."no_image.png'height='250' width='200' align='left' title='1'></object>", 1);
}// JavaScript Document
if(!empty($row[“poster”])和&$row[“poster”]!='N/A'){

tr(“Poster”,“您提到的值在
$row['Poster']

如果是,你可以将它与你考虑的两个值进行比较。

if ($row['poster'] === '' || $row['poster'] === 'N/A') {
    tr('Poster', '<object data="' . $row["poster"] . '" height="250" ' .
            'width="200" align="left" title="object2">' . 
            '<img src="' . $image_dir . '/no_image.png" height="250" ' . 
            'width="200" align="left" title="2"></object>', 1);
} else {
    tr('Poster', '<object data="' . $row["poster"] . '" height="250" ' .
            'width="200" align="left" title="object2">' . 
            '<img src="' . $image_dir . '/' . $row["poster"] . '" height="250" ' . 
            'width="200" align="left" title="2"></object>', 1);
}
if($row['poster']==''| |$row['poster']==='N/A'){
tr(‘海报’,“”)。
'', 1);
}否则{
tr(‘海报’,“”)。
'', 1);
}

我不知道什么是
tr
函数,但是如果您确定使用的格式正确,那么上面的代码应该会这样做。您需要确保
$image\u dir
是正确的。

注意到语法颜色编码吗?谢谢,但这并没有起到作用:(对不起,我没有看到语法错误,我有一部分是红色盲的。这似乎是有效的:D我已经在不同的wyas中尝试过了,它似乎很有效!我会将此标记为已接受的答案!谢谢你,伙计!