小编Cra*_*der的帖子

将多个参数传递给匿名函数w/call_user_func

我有一个参数数组,我想通过它传递给函数call_user_func.以下代码目前将给出错误:Missing argument 2 for Closure.如何重写才能正常工作?

$args = array('foo', 'bar');
call_user_func(function($arg1, $arg2) {}, $args);
Run Code Online (Sandbox Code Playgroud)

php anonymous-function

7
推荐指数
1
解决办法
7269
查看次数

将数据库中的结果导入textarea

我有一个编辑页面,用数据库中的原始内容填充内容,我使用内联php,它用标题填充字段,所有其他字段也可以.当我尝试使用相同的方法填充textarea时,它不起作用.除了作为文本的textarea之外,所有其他字段都是varchar.php是表单的值.

            require_once('includes/db.inc.php');
            $stmt = $mysqli->prepare("SELECT
                            postID,title,content,author,image 
                            FROM posts where postID = ?");
            $stmt->bind_param("i",$_GET['postID']);
            $stmt->execute();
            $stmt->bind_result($postID,$title,$content,$author,$image);
            $stmt->fetch();
            $stmt->close();


            ?>
            <section id="createPost">
                <form method="post" action="editPost.php">
                    <fieldset>
                        <legend>Edit Post: <?php echo $title ?></legend>
                        <input name="postID" type="hidden" value="<?php echo $postID; ?>">
                        <label for="titleOfPost">Title of Post:</label><br />
                        <input type="text" name="titleOfPost" size="82" placeholder="Enter title of post" required value="<?php echo $title ?>"><br />
                        <label for="bodyOfPost">Content of Post:</label><br />
                        <textarea cols="60" name="postContent" rows="10" placeholder="HTML tags allowed" value="<?php echo $content ?>"></textarea><br />
                        <label for="authorOfPost">Author:</label><br />
                        <input type="text" name="authorOfPost" size="82" …
Run Code Online (Sandbox Code Playgroud)

html

-1
推荐指数
2
解决办法
6154
查看次数

标签 统计

anonymous-function ×1

html ×1

php ×1