我使用以下脚本将我的目录(在本例中My_Theme
)的文件移动到zip存档wordpress.zip
.
define('CLIENT_PATH', $_SERVER['DOCUMENT_ROOT'] . '/wp_theme/clients_templates/' . str_replace(' ', '_', $_POST['title']));
$zip = new ZipArchive;
$zip->open('wordpress.zip', ZipArchive::CREATE);
foreach (glob(CLIENT_PATH . "/*.*") as $file) {
echo $file . '<br>';
$zip->addFile($file);
}
$zip->close();
Run Code Online (Sandbox Code Playgroud)
现在当我下载并解压缩该文件时,我的文件夹结构如下所示:
我想要的是将目录移动My_Theme
到wordpress/wp-content/themes/
结果将是:( wordpress/wp-content/themes/My_Theme
包括其中的所有文件和子目录)
我怎样才能做到这一点?
我有一个多维数组,其中包括ID和URL.我想只输出网址.
$abstract_details = array(
array(
'id' => 68769782222,
'url' => 'http://yourclick.ch'
),
array(
'id' => 111,
'url' => 'http://google.com'
)
);
foreach ($abstract_details as $abstract_detail) {
foreach ($abstract_detail as $get_abstract_detail) {
$result .= $get_abstract_detail . '<br>';
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行我的代码时,我得到了两个信息.如何控制我想要展示的内容?
我想弄清楚哪些复选框被选中,所以我尝试了以下代码:
$('.feature input[type="checkbox"').serialize();
Run Code Online (Sandbox Code Playgroud)
这是我的 HTML 的样子:
<div class="feature">
<h2>Features</h2>
<label><input class="custom_css" checked="" type="checkbox" name="feature[]"> Custom CSS (style.css)</label>
<label><input class="custom_js" checked="" type="checkbox" name="feature[]"> Custom Javascript (script.js)</label>
<label><input class="modernizr" type="checkbox" name="feature[]"> Modernizr</label>
<label><input class="google_maps" type="checkbox" name="feature[]"> Google Maps</label>
<label><input class="custom_api" type="checkbox" name="feature[]"> Custom API</label>
<label><input class="font_awesome" type="checkbox" name="feature[]"> Font Awesome</label>
</div>
Run Code Online (Sandbox Code Playgroud)
这是我得到的输出:
数组(1) { ["var_sent_via_ajax"]=> 字符串(67) "feature%5B%5D=on&feature%5B%5D=on&feature%5B%5D=on&feature%5B%5D=on" }
现在我怎样才能知道其中哪些已经被检查过呢?%5B%5D符号是什么意思?
我想改变这个字符串
测试 - GGAökologieGeschäftsführer.PDF
进入这个:
测试_-_ gga_oekologie_geschaaeftsfuuehrer.pdf
这是我尝试过的:
$characters = array('ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü', ' ');
$converted_characters = array('ae', 'oe', 'ue', 'AE', 'OE', 'UE', '_');
$string = 'Test - GGA o?kologie Gescha?ftsfu?hrer.PDF';
echo strtolower(str_replace($characters, $converted_characters , $string));
Run Code Online (Sandbox Code Playgroud)
上面的代码返回:test _-_gga_ökologie_geschäftsführer.pdf
如您所见,字符串仍包含字符ö和ä.
我的代码出了什么问题?
Is there a way to force a part of a text to display on a new line with CSS?
So when the HTML looks like this:
<p>Hello, my name is John.</p>
Run Code Online (Sandbox Code Playgroud)
The result will be:
Hello,
my name is John.
The HTML is generated dynamically, so I cannot change it.
我有一个包含一些函数的数组,它看起来像这样:
var all_questions = [
show_question(1, 1),
show_question(2, 1),
show_question(3, 1),
];
Run Code Online (Sandbox Code Playgroud)
我想随机将这些函数运行到该数组中.我怎样才能做到这一点?