I have a problem reading xml with php, thank you.

The xml file is: http://114.80.235.12http://114.80 .236.202 My php code is written like this, but it cannot be read. Thank you //2. Read xml$xml_array=simplexml_load_file(“wc.xml”); //Read the data in XML into an array object in foreach($xml_array AS $temp){echo “”; print_r($temp->f);echo ” “;} My purpose It is to read the two http addresses in the middle. Thank you. Reply to discussion (solution) xpath=’//f[2]/text()’ xpath=’//f[2]/text()’ Thank you, could you please clarify it again? I found one on Baidu, but there is no Something print_r($xml_array->a->f); $s =<<<XMLhttp://114.80.235.12 http://114.80.236.202 XML;$xml = simplexml_load_string($s);//For normal traversal, you need to know exactly the level of the target node foreach($xml AS $temp){ foreach($temp->f as $v) echo “$vxpath(‘//f’) as $v) echo “$v”; all available http://114.80 .235.12 http://114.80.236.202 [code=php]$s =<<<XML <v time=" 180530" vi="1" ch="29" nls="0" title="Real surveillance video" code="qT4j-61ws-Q" Thank you for your help. wish you happy everyday. I want to learn more, what kind of knowledge is this? What knowledge should I search for? Thank you. If you print_r($xml_array); you can see SimpleXMLElement Object( [@attributes] => Array ( [time ] => 180530 [vi] => 1 [ch] => 29 [nls] => 0 [title] => Monitoring real shot [code] => qT4j-61ws-Q [enable] => 1 [logo] = > 0 [wt] => 0 [band]…

A question about PHP file reference, please help me look at it, thank you

A PHP question, please help me, I define a constant in index.php define(‘SCRIPT’,’index’); and reference the file title.php require ‘title.php’; In title.php, I did not reference the index.php file, but the values ​​of the constants in index.php can be printed out normally echo SCRIPT; //Result index Can the referenced php file use the constants and variables in the referrer php file? Example: index.php references title.php, can title.php use the constants and variables defined in index.php? Reply Discussion (Solution) Yes, you just need to pay attention to the order. Define first, then use If you browse http://localhost/title.php directly, the index should not be printed, and the printed value should be SCRIPT At that time, if you browse http://localhost/index.php, it will be printed out, and the value is index In fact, when I quoted it, I simply copied the code directly based on my understanding. ! Global variables or constants defined before require ‘title.php’; can be used in title. Access in php define(‘SCRIPT’,’index’); define defines global constants and can be accessed anywhere After trying it, the “referenced page” can use the constants defined in the “reference page”, whether before or after the reference statement. But you cannot use the variables in the…

[php-fpm problem] An experienced veteran can come and take a look, thank you.

The service is nginx+php-fpm. Recently, another version of php-fpm was installed, which introduced a problem: Post upload Multipart file form, php-fpm will write temporary files, but there are many temporary files. It will not be cleaned up. This has not been found before, resulting in more than 200,000 temporary files in the final directory, and the php-fpm process is all in D status waiting for the disk. The current temporary solution is to regularly clean up the temporary files 5 minutes ago with crontab, but this does not solve the root problem. According to the log, it is roughly determined that the request volume is not lost, but the temporary files are not unlinked, which is very puzzling. Has anyone encountered this kind of online problem? Thanks. Reply to discussion (solution) After uploading the file to the temporary directory, should not execute move_uploaded_file to the final directory? Well? Did the move fail when you called this function? Or set the temporary file directory to your final file upload directory? You are a Linux moderator, don’t you think about permission issues? Most unlink failures are caused by permission issues Borrowing flowers to worship Buddha, a reply from the manual: —————— ———————————————–…

PHP synchronizes large-scale collection, very difficult problem, novices are not allowed to enter, thank you

1. The program is similar to myip.cn/wanben.net. Its website can collect all the information of wanben.net within 3 seconds. 2. I can also collect all the information from wanben.net through PHP, but the speed is too slow, such as collecting website title collecting alexa information collecting domain name Information Collect server information, The program I wrote through PHP needs to execute all codes sequentially. Therefore, it takes a long time, and it takes about 15 seconds to complete all collection Myip.cn collects the same amount of information above, which takes about 3 seconds. Experts, please answer whether you use php+ajax or php synchronous batch collection. Please give the principle My website wanben.net collection I wrote it all myself, and now I need to quickly collect and return values ​​in large batches. Reply to discussion (solution) 1. The program is similar to myip.cn/wanben.net. His website can collect all the information of wanben.net within 3 seconds. 2. I can also collect all the information from wanben.net through PHP, but the speed is too slow, such as collecting website title collecting alexa information collecting domain name Information Collect server information, The program I wrote through PHP needs to execute all codes sequentially. So…

Please tell me how to save data in php, thank you!

My brother has a data query website, and the amount of data is expected to be very large. I initially wanted to insert it into mysql for the convenience of query, but according to actual measurements, the amount of data inserted every day may be more than 100M. If I use mysql, the cost is estimated to increase, and I don’t know how efficient it will be. Sample. So I want to save the data in the form of a file. I have considered txt and xml. Reading the file is a little troublesome but not a big deal. But I recently thought, can I use serialization to save it into a file? (Because my data essentially belongs to some array data), if it is all serialized and deserialized directly when reading, the efficiency should be much faster? I would like to hear the opinions of experts, thank you! ! Reply to discussion (solution) The number of query reads should be orders of magnitude greater than writes, right? If you don’t use files in the database, IO will consume the machine. The number of query reads should be orders of magnitude more than writes, right? If you don’t use files…

How to batch process mysql data using php? I hope the experts can provide the code directly, thank you!

For example, there are several pieces of data in the database, and you want to insert the sum obtained by adding two fields in each piece of data into another field: cca ccb ccd id 45 66 0 1 67 36 0 2 86 24 0 5 76 84 0 8 6 55 0 12 …… The single calculation is as follows: simplequery($q);$a=$obj_db->fetchRow($r,DB_FETCHMODE_ASSOC);$ccd=$a[cca]+$a[ccb];$obj_db->simplequery(“update member set ccd=’ $ccd’ where id=’5′”);?> Is there any way to calculate each piece of data in batches at once? Please give detailed code, thank you! Reply to discussion (solution) $obj_db->simplequery(“update member set ccd=cca+ccb where id=’5′”); $obj_db->simplequery(“update member set ccd=cca+ccb where id=’5′”); Like. . $obj_db->simplequery(“update member set ccd=cca+ccb”); $obj_db->simplequery(“update member set ccd=cca+ccb”); This is what the poster requested, and the entire table can be done at once This is standard SQL, just like PHP It doesn’t matter. grammer: update tablename set cloum=” where .. $obj_db->simplequery(“update member set ccd=cca+ccb”); Thank you very much! Let me ask you again: If you want to judge whether cca+ccb>110 is calculated, why is it wrong to write like this: $obj_db->simplequery(“update member set ccd=cca+ccb where sum(cca +ccb)>110”); Please help correct the code, thank you! update member set ccd=cca+ccb where cca+ccb>110 update member set…

TestIf you want to replace it with Test, please replace it with PHP regular expression, thank you.

For example: Test I want to replace it with Test. Please replace it with PHP regular expression, thank you. Because my HTML code is as follows: News 一 2014-03-12 News 2 2014-02-20 Want to replace with News One 2014-03-12 News Two 2014-02-20 p> Reply to discussion (solution) Match first. Then assemble the results. $s=<<<TXT News 1 2014-03-12 News 2 2014-02-20 TXT; preg_match_all (‘#]+>\s*]+>(.+?)\s*]+>(.+?)<#s', $s,$m);$html="\n”;foreach($m[1] as $k=>$v) $html .= ” $v {$m[2][$k]}\n”;$html .= ”;echo $html; It’s better to use str_replace Match first. Then assemble the results. $s=<<<TXT News 1 2014-03-12 News 2 2014-02-20 TXT; preg_match_all (‘#]+>\s*]+>(.+?)\s*]+>(.+?)<#s', $s,$m);$html="\n”;foreach($m[1] as $k=>$v) $html .= ” $v {$m[2][$k]}\n”;$html .= ”;echo $html; Thank you very much Moderator’s answer I tested it and it really works. But I also want the hyperlink to have a specific address, in the form: News 1 2014-03-12 News 2 2014-02-20 </ul Master moderator, Zhengze And FOREACH, can you give me a rough explanation? Thank you. Master, if the points are not enough, you can add more~~~~ Thank you. preg_match_all(‘#]+>\s*]+>(.+? )\s*]+>(.+?)<#s',$s,$m);$html="\ n”;foreach($m[1] as $k=>$v) $html .= “{$m[2][$k]} {$m[3][$k]}\n”;$html .= ”;echo $html; The moderator is very powerful~~~ Like One~ It’s a knot, ha.

navicat activation code 2021 [2021 latest]

Please decrypt the php file and delete the authorization code, thank you

php vb go xss Write your review! Come on, watch it all Member login | User registration Recommended reading ip AJAX is no longer a “search engine killer” AJAX is no longer a “search engine killer”… [detailed] Crayon Shin-chan 2023-09-11 11:02:24 ip navicat activation code 2021 [2021 latest] (navicat activation code 2021) 2021 recently shared a usable activation code, hoping to help friends who need activation. This is currently available, but it will become ineffective if used by too many people. It will be updated from time to time. Please continue to pay attention to this website~… [detailed] Crayon Shin-chan 2023-09-11 11:52:08

TinkPHP+EasyUI, how to conditionally query the database with json? First, thank you!

href:’/index.php/Article/sblog/id/’+idd, //$json is NULL output template. When it is 1, the list data is output to the front end in the format of Json public function sblog($json=NULL,$id=NULL){ if(!is_int((int)$json)){ $json = NULL; } //dump( $id); Here the ID can be displayed as 16 if($json==1){ $sblog = M(‘Sbly_table’); //$id = intval($id); //$info = $sblog->order (‘id desc’)->where(‘lj_sbid=’.$id)->select(); $info = $sblog->order(‘id desc’)->select(); $new_info = array() ; foreach($info as $t){ if($t[‘lj_ly_zt’]==1){ $t[‘lj_ly_zt’] = ‘on’; }else{ $t[‘lj_ly_zt’] = ‘off’ ; } $new_info[] = $t; } echo json_encode($new_info); unset($sblog,$info,$new_info); }else{ $this->display(); } unset($Public); } When $json=1, the following three pieces of content are output: [{“id”:”38″,”user_id”:”1″,” title”:”001″,”lj_sbid”:”16″},{“id”:”36″,”user_id”:”1″,”title”:”002″,”lj_sbid”:”18″}, {“id”:”34″,”user_id”:”1″,”title”:”003″,”lj_sbid”:”17″}] After front-end processing, 3 rows of data can be displayed correctly, but I only want to To display data with lj_sbid=16, $info = $sblog->order(‘id desc’)->where(‘lj_sbid=16’)->select(); This will display it correctly lj_sbid is a piece of data of 16, but like this: $info = $sblog->order(‘id desc’)->where(‘lj_sbid=’.$id)->select(); Can’t output? How should I write it? Thank you all in advance Reply to the discussion ( Solution) There is nothing wrong with what you wrote in theory. You can try to output the value of $id The order should be after where $id can output 16, what is the error? What you want is…

Teacher Li Yanhui PHP Season 1 Chapter 1 Section 2 Video Why was the Guset project not installed successfully? I followed the teacher step by step, please give me some advice, thank you!

Web page prompt: Warning: mysql_connect(): Access denied for user ‘root’@’localhost’ (using password: YES) in D:\AppServ\www\Guest\conn.php on line 6 (several garbled diamond symbols) (Sorry, the picture cannot be uploaded) ps: The database has been loaded successfully Reply to discussion (solution) MySQL The login password is wrong Change the character set of the browser to gb2312 to see what the garbled characters are The database password is wrong You followed the step by step, but the configuration parameters of mysql need to be changed, such as username and password. Thank you everyone, I set the database login name and password myself, there is nothing wrong. I successfully imported the guest database, but the website cannot be opened through http://localhost:8082/guest in the browser window. This is the imported database This is an error message Isn’t it very clear? The root user’s password is incorrect You set a password and didn’t change it in the program Change the password in mysql_connect() in conn.php to your local mysql root password I don’t know, I just remember that I set the username root and password XXXX. How can I change it? Thank you~ Thank you all, the problem is solved~~Thank you~~~ Fill in the username and…

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
首页
微信
电话
搜索