首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在php中打印多个数组并存储在mysql数据库中?

如何在php中打印多个数组并存储在mysql数据库中?
EN

Stack Overflow用户
提问于 2018-08-03 01:42:35
回答 1查看 0关注 0票数 0

我正在将数据存储到MySQL数据库本地,我是PHP编码的新手,所以需要帮助将这些数据存储到本地数据库中。

以下数组需要打印并存储在db中 :

代码语言:javascript
复制
Array
        (
            [name] => Administration Line Without An ACL Configured
            [title] => <table border="1">
        <tr><td>Rating</td><td>High</td></tr>
        <tr><td>impact</td><td>High</td></tr>
        <tr><td>ease</td><td>Easy</td></tr>
        <tr><td>fix</td><td>Quick</td></tr>
        </table>
            [findingtitle] => Array
                (
                    [2.3.1] => Finding
                    [Finding] => Array
                        (
                            [text] => Array
                                (
                                    [0] => Some devices use administrative line configurations to configure which administrative services, such as Telnet and Secure Shell command line services, should be offered by the device. Additionally administrative lines can be configured to specify additional options such as authentication methods, access restrictions, timeouts and more.
                                    [1] => DWS determined that on AD-FIN-2 no inbound ACL was configured on the administrative line detailed in Table .
                                )

                        )

                    [2.3.2] => Impact
                    [Impact] => Array
                        (
                            [text] => Without any administrative line inbound management host address restrictions an attacker, or malicious user, would be able to connect to an administrative line service. If the service requires authentication and the attacker does not have any authentication credentials, they could attempt to gain access to the service using a brute-force attack. Furthermore, if a software vulnerability is present in the service then allowing anyone to connect to the service could enable an attacker to exploit the vulnerability.
                        )

                    [2.3.3] => Ease
                    [Ease] => Array
                        (
                            [text] => With no administrative line inbound network host access restrictions an attacker would not be prevented by the device from connecting to the services offered. Administrative service client access tools are commonly installed by default on desktop operating systems and hacking tools, clients and exploit code are also available on the Internet for a number of different administrative services.
                        )

                    [2.3.4] => Recommendation
                    [Recommendation] => Array
                        (
                            [text] => Array
                                (
                                    [0] => DWS recommends that an ACL is created to restrict access from only those network hosts that require access. DWS then recommends that the ACL should be applied to the line in order to restrict inbound access to the administrative services.
                                    [1] => Notes for Cisco Catalyst Switch devices:
                                    [2] => On Cisco Catalyst Switch devices an inbound ACL can be created and assigned to an administrative line using the following commands:
                                )

                        )

                )

            [outputtb] => Array
                (
                    [AD-FIN-2 administrative line with no inbound ACL] => Array
                        (
                            [item] => <table border="1" width="100%"><tr><th>Line</th><th>Access</th><th>Login</th><th>Level</th><th>Password</th><th>Telnet</th><th>SSH</th><th>Filter In</th></tr><tr><td>VTY 0 - 4</td><td>Yes</td><td>Local Users</td><td>1</td><td></td><td>No</td><td>Yes</td><td></td></tr></table>
                        )

                )

        )

请帮我一个打印数据并存储在MySQL DB中的代码。

EN

回答 1

Stack Overflow用户

发布于 2018-08-03 11:18:17

你可以用JSON输入MySQL。在这种类型中,可以保存非结构化数据(数组或对象)。例子:

代码语言:txt
复制
CREATE TABLE t1 (jdoc JSON);
INSERT INTO t1 VALUES('[1, 2, "string", {"key1": "value1"}]');
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/-100001895

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档