我无法将ID传递给控制器​​?

时间:2016-07-30 06:58:34

标签: codeigniter-3

我尝试播放歌曲并将动态ID传递给控制器​​。但我尝试了这段代码。

 <?php 
    $i = 1;
    foreach ($view as $row)
    {
        echo "<tr>";
        echo "<td>".$i."</td>";
        echo "<td>"."<a href='<?php echo base_url();?>admin/play/$row->audio'".$row->audio."</a></td>";

        $i++;
        echo "</tr>";
    }
   ?>

在检查元素锚时显示直接php代码而不是localhost / bla / bla /我该如何解决这个问题?我的控制器名称是播放,我想传递其特定名称的值。我的串联是正确的吗?

1 个答案:

答案 0 :(得分:1)

你打开两次php标签。像这样:

 http = require('http');
 fs = require('fs');
server = http.createServer( function(req, res) {

console.dir(req.param);

if (req.method == 'POST') { //-- Here Process POST requests
         console.log("POST");
         var body = '';
         req.on('data', function (data) {
           body += data;
          console.log("Partial body: " + body);
         });
         req.on('end', function () {
            console.log("Body: " + body);
         });
         res.writeHead(200, {'Content-Type': 'text/html'});
          res.end('post received');
     }
 else
 {  //!!!----Here process HTML pages
    console.log("GET");
    //var html = '<html><body><form method="post" action="http://localhost:3000">Name: <input type="text" name="name" /><input type="submit" value="Submit" /></form></body>';
    var html = fs.readFileSync('index.html');
    res.writeHead(200, {'Content-Type': 'text/html'});
    res.end(html);
 }

});

port = 3000;
host = '127.0.0.1';
server.listen(port, host);
console.log('Listening at http://' + host + ':' + port);