[Seemingly challenging] How does shell get the return value in php?-php Tutorial

Source: Internet
Author: User
[Seemingly challenging] How does shell obtain the return value in php? for example, the php file returns an array & nbsp; PHPcode & lt ;? Phpreturnarray (a & gt; 1, B & gt; 2, c & gt; public, d & gt;, e & gt ;,);? & Gt; in she [seemingly challenging] How does shell get the return value in php?
The php file returns an array.

PHP code
  
   '1',  'b' => '2',  'c' => 'public',  'd' => '',  'e' => '',);?>


How can I receive this array in shell?

------ Solution --------------------
PHP code
[User: root Time: 07: 23: 08 Path:/home/liangdong/php] $ php. php Array ([a] => 1 [B] => 2 [c] => public [d] => [e] =>) [User: root Time: 07: 23: 10 Path:/home/liangdong/php] $ cat. php
  [User: root Time: 07: 23: 12 Path:/home/liangdong/php] $ cat B. php
  '1', 'B' => '2', 'C' => 'public', 'D' => '', 'E' => '',);?>
------ Solution --------------------
Shell is not familiar with it. I guess I will use it later, so I studied one,

PHP code
#! /Bin/basheval 'cat php_data.txt | grep "=>" | tr-d ",> \ '" | xargs-I {} echo {}\; | tr "\ n" 'echo $ {a} echo $ {B} echo $ {c} echo $ {d}
------ Solution --------------------
Cross-language data exchange requires a data structure that can be identified by both parties,
Otherwise it will be meaningless.

If your sample php code has been pre-compiled by zend, or is blocked by Wei shield (you cannot say that it is not a php file)
Then how do you separate the data in shell?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.