是否可以更改PHP Shell_Exec的输出宽度?

时间:2018-02-16 16:24:20

标签: php

我正在寻找解析我从PHP shell_exec回来的输出。但是,返回的一些输出是表格格式,数据包含在列中,如下所示...

Name                       Installed      Proposed  Message
                            Version        version
Views Bulk Operations      7.x-3.3        7.x-3.4   Update available
(views_bulk_operations)
Chaos tools (ctools)       7.x-1.12       7.x-1.13  Update available
CAS (cas)                  7.x-1.5        7.x-1.7   Update available
Custom Search              7.x-1.18       7.x-1.20  Update available
(custom_search)
Date iCal (date_ical)      7.x-3.5        7.x-3.9   Update available
Entity API (entity)        7.x-1.8        7.x-1.9   SECURITY UPDATE available
Field Group (field_group)  7.x-1.5        7.x-1.6   Update available
Media (media)              7.x-1.6        7.x-2.16  SECURITY UPDATE available
Insert (insert)            7.x-1.3        7.x-1.4   Update available
Views (views)              7.x-3.16       7.x-3.18  SECURITY UPDATE available
Views Data Export          7.x-3.0-beta8  7.x-3.2   SECURITY UPDATE available
(views_data_export)
Views PHP (views_php)      7.x-1.0-alpha  7.x-1.0-  Update available
                           1              alpha3
Athena (athena)            Unknown        Unknown   Project was not packaged
                                                    by drupal.org but
                                                    obtained from git. You
                                                    need to enable git_deploy
                                                    module

为了更容易解析,我希望能够改变输出的宽度,以便数据不会被包装。

我假设用stty指定控制台的宽度会起作用,但它没有。我试过这个......

$output = shell_exec('stty cols 180; cd /; cd ' . $drupal_sites_folder_path . $list_of_drupal_sites[22] . '; drush pm-updatestatus');

...但输出宽度仍然设置为80列。

有关如何更改shell_exec的输出宽度的任何建议?

0 个答案:

没有答案