PHP string operation, how to solve it-php tutorial

PHP string operations $getstr=”id=189,pc=0,pt=0,valide=1\r\nid=176,pc=0,pt=0 ,valide=1\r\nid=177,pc=0,pt=0,valide=1\r\n”; I want to use \r\ Divide the string in the form of n to get an array, and then get the value in the form of key-value pairs,For example, get the value of the first id$getid=$arr[“id”] Please give some advice ——Solution——- ————- $getstr = “id=189,pc=0,pt=0,valide=1\ r\nid=176,pc=0,pt=0,valide=1\r\nid=177,pc=0,pt=0,valide=1\r\n”;foreach (explode(“\r\n”, $getstr) as $row) { if($row) { parse_str(strtr($row, ‘,’, ‘&’), $t ); $res[] = $t; }}echo $res[0][‘id’];

ThinkPHP newbie POST is invalid, how to solve it-php tutorial

ThinkPHP Newbie POST is invalid This post was last edited by bluicezhen on 2013-03-18 22:38:39 The page is displayed according to the POST value, but it seems that it cannot be obtained POST value: $username = $this->$_POST[‘username’];//$name = $this-> _post(‘name’); Invalid if changed to this industry. $user = M(‘user’);$data = $user->where(‘username=”‘.$username.'”‘)->field(‘id,username’) ->find(); if($data) { $this->success(‘success’);}else{ $this->error(‘failure ‘);} But using the _param method succeeded. Please experts explain. thinkphp?post php ——Solution ——————–Isn’t your post parameter username? $this->_post(‘name’); Of course it doesn’t work, $this->_post(‘username’); try it— —Solution——————–The original poster dump($_POST); try love

Urgent question about PHP not being able to retrieve data, how to solve it – PHP tutorial

urgent! Regarding the inability to retrieve data from PHPPlease take a look at what is written incorrectly, so that the data cannot be retrieved! $newcihui = sccihui($row[cihui]); php ——Solution——————–$row[‘cihui‘]——Solution ——————–Type var_dump($row);exit; in front of the statement to see if there is data in $row and what its structure is.

String decomposition, how to solve it-php tutorial

String decomposition{“status”:1,”info”:”ok”,”data”:{“html”:” qweriqw eppa \n\t\t \n\t\t qweriqw eppa \n\t\t \n\t\t qweriqw eppa \n\t\t \n\t\t qweriqw eppa \n\t\t \n\t\t …….. How to read the content of each li. The li has roughly this style. I need to decompose each li and then analyze it. How to write… Need code… Thank you ——Solution Solution——————–$cOntents= “”; //I will not type the code in the picture preg_match_all(“——Solution——————–.*?——Solution——————–is”,$contents,$match); print_r($match);//Display the $match array, which is the matching data Press Change this

phpfsockopen concurrency, how to solve it-php tutorial

php fsockopen concurrencyAdvice on fsockopen concurrency. I want to send emails but I don’t know how to send emails concurrently with fsockopen ——Solution— ——————You can send emails in an ajax loop, or you can use the following two methods (the code in the west is the general idea): if (isset($_GET[‘act’]) && $_GET[‘act’] == ‘sendMail’) { sendEmail() ;//Send email operation}function fSockGet($url, $timeout = 3){ $info = parse_url($url); extract($info); $query = isset($query) ? trim($query) : ”; $path = isset($path) ? trim($path) : ‘ ‘; $fp = fsockopen($host, 80, $errno, $errstr, $timeout); if (!$fp) { exit(“$errstr ($errno)\n”); } $write = fwrite($fp, “GET {$path}?{$query} HTTP/1.0\r\ nHost: {$host}\r\n\r\n”);// while (!feof($fp)) {// echo fread($fp, 4096 );// }}$url = “http://mydir.com/index.php?act=sendMail”;$emailList = array(…);foreach ($emailList as $email) { fSockGet($url);}

Is there an offline version of lamp one-click installation package, how to solve it – php tutorial

Is there an offline version of lamp one-click installation package?I want to install LAMP on a centos virtual machine. All the resources I search need to be able to connect to the external network. But the network configuration of my virtual machine cannot connect to the external network. Heroes, are there any offline version of the installation package resources ——Solution—— —————Just download the CentOS DVD and add the DVD Repo to the Yum source——Solution——————–Use lnmp. http://www.baidu.com/s?wd=amh If you don’t want the offline version, you need to change the script. Directly download the php mysql nginx package and unzip the script. Remove wget. ——Solution——————–http:/ /sourceforge.net/projects/xampp/files/XAMPPLinux/——Solution—————– —http://sourceforge.net/projects/xampp/files/XAMPPLinux/There are several offline versions of xampp here, download them and copy them to your Linux using a USB flash drive. Just install it, the installation method is:http://www.apachefriends.org/zh_cn/xampp-linux.html#1677

The homepage of the open source community website has been revised, support is welcome, how to solve it – php tutorial

The homepage of the open source community website has been revised, support is welcome, how to solve it – php tutorial

The homepage of the open source community website has been revised, welcome to supporthttp://youyax.stu80.com/ An excellent software needs an atmospheric image Page – —–Solution——————–Come on

Smarty’s section can force the end of looped fields, how to solve it – PHP tutorial

Fields that smarty’s section can force to end the loopWhat are the fields that smarty’s section can force to end the loop? ——Solution——————–It’s definitely possible in smarty 3! {break}is translated into

A PHP paging program, error reporting, how to solve it – PHP tutorial

A PHP paging program, reporting an errorThis is the page turning program: PHP code http://www.CodeHighlighter.com/–>include_once(‘conn .php’);if(isset($_GET[‘pclass’])) { $p_class=$_GET[‘pclass’]; }else { $p_class=”; }$respage = mysql_query(“SELECT COUNT(* ) FROM product where p_class=’$p_class’;”); //$num is the total number of records that meet the conditions in the data table while($row = mysql_fetch_assoc($respage)) { $num = $row[0];/ /This line reports an error: Notice: Undefined offset: 0 in D:\setup\xampp\htdocs\products\showclass.php on line 88 } $recordnum =40; //How many records are displayed on each page, $pages = ceil($ num/$recordnum); //How many pages are there if (@$_GET[“page”]) // Get the parameter page in the url { //$pre and $next are the connections between the previous page and the next page Value of parameter page // If the parameter in url is 1, set the current page to 1, the previous page, $pre is also 1, $next is 2 if($_GET[“page”]==1) { $current = 1; //Current page $pre = 1; //$pre is the previous page $next = 2; //$next is the next page} else { $current = $_GET[“page”]; $pre = $current-1; $next = $current+1; } // If the parameter in the url is not one (not the first page), the value of the current page is the parameter obtained in the…

YouhaveanerrorinyourSQLsyntax,how to solve it-php tutorial

You have an error in your SQL syntax<?phpfunction _query($_sql) { if (!$_result = mysql_query($_sql)) { exit(‘SQL Execution failed’.mysql_error()); } return $_result;}function _fetch_array($_sql) { return mysql_fetch_array($this->_query ($_sql),MYSQL_ASSOC);}function _is_repeat($_sql,$_info) { if ($this->_fetch_array($_sql)) { _alert_back( $_info); } } _is_repeat( “SELECT commodity_name FROM commodity WHERE commodity_name='{$_goods[‘commodity_name’]}’ LIMIT 1” , ‘Sorry, this product already exists’ ); $DB->_query( “INSERT INTO commodity( commodity_name, Sale_Address, Seller, Production_Address, Company, permit_number, content ) VALUES( ‘{$_goods[‘ commodity_name’]}’ , ‘{$_goods[‘Sale_Address’]}’, ‘{$_goods[‘Seller’]}’, ‘{$_goods[‘Production_Address’ ]}’, ‘{$_goods[‘Company’]}’, ‘{$_goods[‘permit_number’]}’, ‘{$_goods[‘content’]} ‘, )” ); ?> My An error occurred while the program was running: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘)’ . There is too much code, so I only posted the code related to the problem. If you can’t see it clearly, I can post all the code. I hope you can help me. I’m still a newbie, so I hope I can explain it in a simpler way. Thank you ——Solution——- ————-‘{$_goods[‘content’]}’, there is an extra comma

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索