bluesoleil
Registered
Как да направя търсачка която да търси в news.txt,понеже имам инсталиран cutenews
Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
$file = "news.txt"; //файла, в който ще търсиш
$keyword = "asd"; //думата , която търсиш
$begin = file_get_contents("file.txt");
preg_match("/".$keyword."/", $begin, $matches);
print_r($matches);
slideR каза:$file = "news.txt"; //файла, в който ще търсиш
$keyword = "asd"; //думата , която търсиш
$begin = file_get_contents("file.txt");
preg_match("/".$keyword."/", $begin, $matches);
print_r($matches);
<?php
if(isset($_POST['submit')){
$file = "cutenews/data/news.txt"; //файла, в който ще търсиш
$keyword = $_POST['keyword']; //думата , която търсиш
$begin = file_get_contents("cutenews/data/news.txt");
preg_match("/".$keyword."/", $begin, $matches);
print_r($matches); ";
} else {
?>
<form action="search1.php" method="post">
<input type="text" name="keyword" class="searchs" value=" Търси..." onfocus="this.value='';" onblur="if(this.value=='')this.value=' Търси...';" />
<input class="searches" type="submit" value="" name="submit" />
</form>
<?php
}
?>
Parse error: syntax error, unexpected ')', expecting ']' in public_html/proekt/search1.php on line 2
<?php
if(isset($_POST['submit'])){
$file = "cutenews/data/news.txt"; //файла, в който ще търсиш
$keyword = $_POST['keyword']; //думата , която търсиш
$begin = file_get_contents("cutenews/data/news.txt");
preg_match("/".$keyword."/", $begin, $matches);
print_r($matches); ";
} else {
?>
<form action="search1.php" method="post">
<input type="text" name="keyword" class="searchs" value=" Търси..." onfocus="this.value='';" onblur="if(this.value=='')this.value=' Търси...';" />
<input class="searches" type="submit" value="" name="submit" />
</form>
<?php
}
?>
emagi каза:<?php
if(isset($_POST['submit'])){
$file = "cutenews/data/news.txt"; //файла, в който ще търсиш
$keyword = $_POST['keyword']; //думата , която търсиш
$begin = file_get_contents("cutenews/data/news.txt");
preg_match("/".$keyword."/", $begin, $matches);
print_r($matches); ";
} else {
?>
<form action="search1.php" method="post"><input type="text" name="keyword" class="searchs" value=" Търси..." onfocus="this.value='';" onblur="if(this.value=='')this.value=' Търси...';" />
<input class="searches" type="submit" value="" name="submit" />
</form>
<?php
}
?>
Parse error: syntax error, unexpected T_STRING in public_html/proekt/search1.php on line 10
bluesoleil каза:emagi каза:<?php
if(isset($_POST['submit'])){
$file = "cutenews/data/news.txt"; //файла, в който ще търсиш
$keyword = $_POST['keyword']; //думата , която търсиш
$begin = file_get_contents("cutenews/data/news.txt");
preg_match("/".$keyword."/", $begin, $matches);
print_r($matches); ";
} else {
?>
<form action="search1.php" method="post"><input type="text" name="keyword" class="searchs" value=" Търси..." onfocus="this.value='';" onblur="if(this.value=='')this.value=' Търси...';" />
<input class="searches" type="submit" value="" name="submit" />
</form>
<?php
}
?>
Премахвам 10 ред и ми дава грешка на следващиятКод:Parse error: syntax error, unexpected T_STRING in public_html/proekt/search1.php on line 10