我可以让我的开关功能要求或包含文件,它的工作原因是它回声但我无法得到它要求,或包括在那件事,不知道为什么:(我会感激任何帮助,我做错了什么?
<form name="select-action" action="" method="post">
<?php wp_nonce_field( 'select_action_form', 'select_generate_nonce' ); ?>
<select name="actions-picker">
<option value="action_create" name="cj-create">Create A New List</option>
<option value="action_edit" name="cj-edit">Edit Existing List</option>
<option value="action_delete" name="cj-delete">Delete A List</option>
</select>
<input type="submit" name="submit-action" value="Launch!">
</form>
<?php
if ( isset( $_POST['submit-action'] ) ) {
if ( ! wp_verify_nonce( $_POST['select_generate_nonce'], 'select_action_form' ) ) {
wp_die( 'Our Plugin Is Secure Go Get Coffee!' );
} else {
$action = $_POST['actions-picker'];
switch ( $action ) {
case 'action_create' :
require ( 'test.php' );
break;
case 'action_edit' :
echo 'B';
break;
case 'action_delete' :
echo 'C';
}
}
}
?>
答案 0 :(得分:0)
.......
else {
$action = $_POST['actions-picker'];
switch ( $action ) {
case 'action_create' :
ob_start();
require ( 'test.php' );
$output = ob_get_clean();
echo $output;
break;
case 'action_edit' :
echo 'B';
break;
case 'action_delete' :
echo 'C';
}
}
.......