我在Wordpress中创建插件。我在“设置”部分创建了子页面。
add_action('admin_menu', 'my_script_menu_page');
function my_script_menu_page(){
add_options_page( 'Script', 'Script settings', 'manage_options', 'my_script', 'my_script_form');
}
add_action('admin_init', 'my_script_admin_settings');
function my_script_admin_settings(){
register_setting('my_script_group', 'my_script_option');
}
function my_script_form(){
var_dump($_POST);
$options = get_option('my_script_option');
?>
<form action="options.php" method="post">
<?php settings_fields("my_script_group") ?>
<p>
<textarea name="my_script_option[my_script_id]" rows="3" cols="100"><?php echo esc_attr( $options['my_script_id'] ); ?></textarea>
</p>
<p>
<input name="submit" type="submit" value="Save" class="button button-primary">
</p>
</form>
<?php
}
如何检查$ _POST中的内容?它总是空数组。我做错了什么? $ _GET工作正常。它返回页面slug。
如何检查$ _POST在PHP中是否有任何内容?如果按下按钮,我想添加更多动作。
答案 0 :(得分:0)
您只会从表单中删除let mainStoryboard = UIStoryboard(name: "Main", bundle: nil)
var topVc = UIApplication.shared.keyWindow?.rootViewController;
if (self.parent is MasterViewController)
{
parent.navigationController?.popToRootViewController(animated: true)
return
}
if (topVc?.restorationClass == MasterViewController.self)
{
parent.navigationController?.popToRootViewController(animated: true)
return
}
if (topVc?.restorationIdentifier == "MyMeetings")
{
parent.navigationController?.popToRootViewController(animated: true)
return
}
if ( topVc?.isKind(of: MasterViewController.self ))!
{
parent.navigationController?.popToRootViewController(animated: true)
return
}
let vc = mainStoryboard.instantiateViewController(withIdentifier: "MyMeetings") as UIViewController
parent.present(vc, animated: false, completion: nil)
一个错误。