怎样根据$hello数据将$str层层展开?解决方案
怎样根据$hello数据将$str层层展开?
怎样根据$hello数据将$str层层展开?
- PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php $my_arr=array(); $str="DIR_FS_AAA . DIR_WS_CLASSES"; $hello=array( "DIR_FS_AAA" =>"DIR_WS_TEMPLATE.'includes/'", "DIR_WS_CLASSES" =>"DIR_WS_ADMIN.'helloworld'", "DIR_WS_TEMPLATE" =>"template/", "DIR_WS_ADMIN" =>"admin/" );//怎样得到这样的结果数组: $my_arr=array( "DIR_FS_AAA . DIR_WS_CLASSES", "DIR_WS_TEMPLATE.'includes/'.DIR_WS_TEMPLATE.'includes/'", "template/includes/admin/includes/" );?>
------解决方案--------------------
- PHP code
$my_arr[] = $str;$tmp = preg_replace("/[A-Z_]+/e", "\$hello['\\0']", $str);$my_arr[] = $tmp;$tmp = preg_replace("/[\"']?\s*\.?\s*([A-Z_]+)\s*\.?\s*[\"']/e", "\$hello['\\1']", $tmp);$my_arr[] = $tmp;//testprint_r($my_arr);/**Array( [0] => DIR_FS_AAA . DIR_WS_CLASSES [1] => DIR_WS_TEMPLATE.'includes/' . DIR_WS_ADMIN.'helloworld' [2] => template/includes/admin/helloworld')/**/<div class="clear"> </div>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Go language is an increasingly popular programming language with its concise syntax, efficient performance, and easy development. The Go language provides a powerful template engine - "text/template", but when using it, some people may encounter the "undefined:template.Must" error. The following is a method to solve this error. Import the correct package. When using the "text/template" template engine, you need to import "text/template

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

Golang and Template package: Create personalized user interface In modern software development, the user interface is often the most direct way for users to interact with the software. In order to provide a user interface that is easy to use and beautiful, developers need flexible tools to create and customize the user interface. In Golang, developers can use the Template package to achieve this goal. This article will introduce the basic usage of Golang and Template packages, and show how to create a personalized user interface through code examples.

Data visualization through Golang's Template package. With the advent of the big data era, data visualization has become one of the important means of information processing and analysis. Data visualization can present data in a concise and intuitive way, helping people better understand and analyze data. In Golang, we can use the Template package to implement data visualization functions. This article will introduce how to use Golang's Template package to achieve data visualization and provide code examples. GolangTem

Applicable scenarios: 1. The project scale is not large. 2. The number of users is not very large, and the concurrency requirements are not strong. 3. There is no dedicated operation and maintenance force. 4. Exquisite team size. For some regular projects, or units where the division of corporate responsibilities is not very clear. explain. Often a system goes from requirements to design, development, testing to final launch, operation and maintenance. Often 80% of the tasks are completed by the development team. Therefore, in addition to implementing the system's functions, developers must also provide customers with consultation and answer questions and solve production problems. Just imagine, after an application is launched, there are no monitoring measures. Just like driving a car without any dashboard, no one feels safe on the road like this. How to balance simplicity and efficiency is something worth thinking about. 1. Springb

How to use Flask-Admin to implement the backend management interface Background introduction: With the development of websites and applications, the backend management interface is becoming more and more important. During the development process, we often need a convenient and fast backend management interface to manage data, users and other important information. Flask-Admin is a powerful and easy-to-use Flask extension that can help us quickly implement the background management interface. Flask-Admin is an open source project based on Flask and SQLAlchemy

1. Check the consistency of files in the specified directories of the two servers #!/bin/bash############################## #######Check the consistency of files in the specified directories of the two servers################################ ######By comparing the md5 values of the files on the two servers, the purpose of detecting consistency is achieved. dir=/data/webb_ip=192.168.88.10# Traverse all the files in the specified directory and use them as parameters of the md5sum command. Then get the md5 value of all files and write it to the specified file find$dir-typ

You need the permissions provided by admin to make changes to this file. Solution: 1. After selecting the administrator account on the login interface and entering the password, you can modify the file smoothly; 2. You can right-click the file and select "As Administrator" Solution: 3. Modify file permissions, right-click the file, select "Properties", click the "Security" tab, then click the "Edit" button, select your username, and then check the "Full Control" option ; 4. Use the command prompt to solve the problem; 5. Set UA permissions.
