You don't need to pay attention to the garbled text of funny questions. & lt ;! DOCTYPE & nbsp; HTML & nbsp; PUBLIC & nbsp;-W3CDTD & nbsp; HTML & nbsp; 4.01 & nbsp; TransitionalEN & nbsp; www. w3.orgTRhtml4loose. dtd & gt; & lt; html & gt; & nbsp; & funny question
No need to pay attention to garbled places
New Document
5. it will feel and be internationalized.
Function m_substr ($ str, $ start, $ length ){
$ Str_length = $ start + $ length;
$ Tmp_str = "";
For ($ I = 0; $ I <$ str_length; $ I ++ ){
If (ord (substr ($ str, $ I, 1) = 0x0a ){
$ Tmp_str. ='
';
}
If (ord (substr ($ str, $ I, 1)> 0xa0 ){
$ Tmp_str. = substr ($ str, $ I, 2 );
$ I ++;
}
Else {
$ Tmp_str. = substr ($ str, $ I, 1 );
}
}
Return $ tmp_str;
}
If (isset ($ _ GET ['Page']) {
$ Page = $ _ GET ['Page'];
} Else {
$ Page = 1;
}
$ Counter = file_get_contents ("example.txt ");
$ Length = strlen ($ counter );
$ Page_count = ceil ($ length/400 );
$ Str = m_substr ($ counter, 0, ($ page-1) * 400 );
$ Str1 = m_substr ($ counter, 0, $ page * 400 );
Echo substr ($ str1, strlen ($ str), strlen ($ str1)-strlen ($ str ));
?>
Echo "Asad? : ". $ Page."/". $ page_count ."";
Echo "excuse me? ";
If ($ page> 1 ){
Echo "bike ?? ";
}
If ($ page <$ page_count ){
Echo "location ?? ";
}
Echo "β? ";
?>
?
I am copying textbooks now... I know this is a bad habit. But I won't write it, and I can't just use this 2b method. I would like to ask if there is any way to separate the html and php code? How can I create this file? I don't want to use template engines like smarty, because I don't actually do it ~ I only use introduction ..
Share: More
------ Solution --------------------
Use a framework ..
------ Solution --------------------
function m_substr($str,$start,$length){
$str_length=$start+$length;
$tmp_str="";
for($i=0;$i<$str_length;$i++){
if(ord(substr($str,$i,1))==0x0a){
$tmp_str.='
';
}
if(ord(substr($str,$i,1))>0xa0){
$tmp_str.=substr($str,$i,2);
$i++;
}
else{
$tmp_str.=substr($str,$i,1);
}
}
return $tmp_str;
}
if(isset($_GET['page'])){
$page=$_GET['page'];
}else{
$page=1;
}
$counter=file_get_contents("example.txt");
$length=strlen($counter);
$page_count=ceil($length/400);
$str=m_substr($counter,0,($page-1)*400);
$str1=m_substr($counter,0,$page*400);
$text = substr($str1,strlen($str),strlen($str1)-strlen($str));
include 'tpl.html';
?>
Tpl.html
New Document
5. it will feel and be internationalized.