情节: 在建立优惠券网站时,我意识到他们可以是不是页面独有的内容,但应该在内部使用<main><article> ..here..</article></main>.
问题:仅仅因为w3schools声明:
元素内的内容应该是文档的唯一内容.它不应包含跨文档重复的任何内容.
但我有内容将在文章内.就像每次例如A coupon can be used by entering its code but a deal can only be activated by going to landing page.
这将在我将发布的每个"优惠券"帖子中重复.所以我现在尝试使用的是.
<main><article><main>Unique content</main>
<aside>A coupon can be used by entering its code but a deal can only be activated by going to landing page</aside></article></main>
Run Code Online (Sandbox Code Playgroud)
但是又一次:
Note: There must not be more than one <main> element in a document.
The <main> element must NOT be a descendent of an <article>, <aside>, …Run Code Online (Sandbox Code Playgroud) 我构建了一个函数,它将在括号之间捕获文本并将它们作为数组输出.但问题是我的函数只在字符串中第一次执行.
function GetBetween($content,$start,$end){
$r = explode($start, $content);
if (isset($r[1])){
$r = explode($end, $r[1]);
return $r[0];
}
return '';
}
function srthhcdf($string){
$innerCode = GetBetween($string, '[coupon]', '[/coupon]');
$iat = explode('&&', $innerCode);
$string = str_replace('[coupon]','',$string);
$string = str_replace('[/coupon]','',$string);
$newtext = '<b>'.$iat[0].'</b> <i>'.$iat[1].'</i><b>'.$iat[2].'</b>';
$string = str_replace($innerCode,$newtext,$string);
return $string;
}
$Text = srthhcdf($Text);
Run Code Online (Sandbox Code Playgroud)
但它只匹配第一张[优惠券]和[/优惠券]而不是其他人.就像字符串一样
hello world [coupon]hello && bad && world[/coupon] and also to [coupon] the && bad && world [/coupon]
Run Code Online (Sandbox Code Playgroud)
它输出
Hello world <b>hello </b> <i> bad </i><b> world</b> and also to the …Run Code Online (Sandbox Code Playgroud) 我正在使用flipkart.com提供的API,这允许我搜索并获得结果输出json.
我使用的代码是:
$snapword = $_GET['p'];
$snapword = str_replace(' ','+',$snapword);
$headers = array(
'Fk-Affiliate-Id: myaffid',
'Fk-Affiliate-Token: c0f74c4esometokesndad68f50666'
);
$pattern = "@\(.*?\)@";
$snapword = preg_replace($pattern,'',$snapword);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://affiliate-api.flipkart.net/affiliate/search/json?query='.$snapword.'&resultCount=5');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_ENCODING , "gzip");
curl_setopt($ch, CURLOPT_USERAGENT,'php');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$snapdeal = curl_exec($ch);
curl_close($ch);
$time_end = microtime(true);
$time = $time_end - $time_start;
echo "Process Time: {$time}";
Run Code Online (Sandbox Code Playgroud)
它的时间是: Process Time: 5.3794288635254
哪个方面太多了,关于如何减少这个的任何想法?
我正在开发一个Web应用程序,人们用英语和其他语言发布文章(如论坛).要从帖子标题创建漂亮的永久链接,我使用这样的代码.
PHP:
$ln=preg_replace("/[^A-Za-z0-9[:space:]]/","",$name);
$ln = strtolower($ln);
$ln=str_replace(' ','-',$ln);
Run Code Online (Sandbox Code Playgroud)
这会删除除字母和数字之外的所有字符.但我也希望用中文或印地语等其他语言保留文字.所以它不会剥离" ????? ???????"到" ".我还没有找到任何REGEX解决方案.
我所做的就是将用户评级和评论保存到表格中,然后从数据库中调用它.现在我要做的是添加所有评级(例如:5 + 4 + 3 = 12),然后将它们除以评级计数(12/3 = 4)并获得平均评级或总评分.
我可以显示评论,但如何添加评级列中的所有值并获得平均值.
if (mysqli_num_rows($mesult) > 0) {
$count = mysqli_num_rows($mesult);
echo '<p class="">'.$count.' Reviews</p>';
while($row = mysqli_fetch_assoc($mesult)) {
$name =$row["name"];
$text =$row["text"];
$heading =$row["heading"];
$rating =$row["rating"];
echo '<div class="review" itemscope itemtype="http://schema.org/Review"> <meta itemprop="itemReviewed" content ="'.$title.'"/> <p class="heading"><strong>'.$heading.'</strong></p><div class="ratings" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"> <meta itemprop="worstRating" content = "1"/><span itemprop="ratingValue">'.$rating.'</span>/<span itemprop="bestRating">5</span></div><p class="reviewtext" itemprop="description">'.$text.'</p><div class="reviewby" itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">'.$name.'</span></div></div>';
}
Run Code Online (Sandbox Code Playgroud)
我也在询问的是
$loutput ="SELECT * FROM rating
WHERE product=$ID";
$mesult = mysqli_query($conns,$loutput);
Run Code Online (Sandbox Code Playgroud) 情节:首先我有一个GodDaddy的网站,他们很酷的CPanel和更酷的停机时间,我转移到数字海洋VPS.
问题:但是当我将文件传输到VPS时,我得到了一些常见/不常见的PHP错误.使用godaddy时我没有看到任何错误.其中一些是.
Notice: Undefined variable: q in /srv/users/someuser/apps/video/public/config.php on line 7
Run Code Online (Sandbox Code Playgroud)
和
Notice: curl_setopt(): CURLOPT_SSL_VERIFYHOST no longer accepts the value 1, value 2 will be used instead
Run Code Online (Sandbox Code Playgroud)
我现在正在使用PHP 5.4(在nginx上,LEMP安装).任何隐藏这些错误的方法,因为即使出现这些错误,我的网站也能正常运行.