以下是重构后的代码:

```php

error_reporting(0);

function get_search_360($name) {

$data = curl_get('https://so.360kan.com/index.php?from=&du=100&fr=100&pb=100&cat=0&st=100&pageno=1&kw=' . $name);

preg_match_all('#js-playicon title=(.*?) data-logger#', $data, $so_name);

preg_match_all('#a href="http:\/\/www.360kan.com\/(.*?).html" class="g-playicon js-playicon"#', $data, $so_url);

preg_match_all('#.*[^\s]#', $data, $so_img);

$arr['data'] = array();

for ($x = 0; $x <= count($so_name['1']) - 1; $x++) {

$arr['data'][$x]['name'] = $so_name[1][$x];

$arr['data'][$x]['url'] = $so_url[1][$x];

$arr['data'][$x]['img'] = $so_img[1][$x];

}

$count = count($arr['data']);

if ($count < 1) {

$arr['msg'] = '获取失败,暂无相关资源!';

$arr['code'] = '203';

} else {

// 其他处理逻辑

}

}

```

以下是重构后的代码:

```php

function get_info_360_m($url) {

$data = curl_get($url);

preg_match_all('#

(.*)

#', $data, $title);

preg_match_all('#(.*)#', $data, $playsite);

$count = count($playsite[1]);

$arr = [

'code' => '200',

'msg' => '获取成功',

'mun' => $count,

'type' => 'false',

'title' => $title[1][0],

'data' => []

];

for ($x = 0; $x < $count; $x++) {

$arr['data'][$x] = [

'sign' => $playsite[1][$x],

'url' => $playsite[3][$x],

'name' => $playsite[4][$x]

];

}

return json_encode($arr, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_FORCE_OBJECT | JSON_UNESCAPED_SLASHES);

}

```

以下是重构后的代码:

```php

function get_info_360_zy($url) {

$data = curl_get($url);

preg_match_all(

'#

(.*?)

#',

$data,

$title

);

preg_match_all(

'##',

$data,

$playurl

);

preg_match_all(

'#\'(.*?)\'#',

$data,

$playimg

);

preg_match_all(

'#(.*?)#',

$data,

$playname

);

$count = count($playurl[1]);

$arr = [

'code' => '200',

'msg' => '获取成功',

'mun' => $count,

'type' => 'false',

'title' => $title[1][0],

'data' => []

];

for ($x = 0; $x < count($playurl[1]); $x++) {

$arr['data'][$x]['url'] = $playurl[1][$x];

}

return json_encode($arr, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_FORCE_OBJECT | JSON_UNESCAPED_SLASHES);

}

```

以下是重构后的代码:

```php

function get_info_360_tv($url) {

$data = curl_get($url);

preg_match_all('#

(.*)

#', $data, $title);

preg_match_all('#playsite:(.*)],#', $data, $playsite);

if (isset($playsite[1][0])) {

$arrer = json_decode($playsite[1][0] . ']', true);

$count = count($arrer);

for ($x = 0; $x < $count; $x++) {

$arr['data'][$x]['sign'] = $arrer[$x]['ensite'];

$arr['data'][$x]['url'] = $url;

$arr['data'][$x]['name'] = $arrer[$x]['cnsite'];

// 添加图片信息

$imgIndex = 2 * $x;

$imgUrl = $playimg[$imgIndex][$x];

$imgName = $playname[1][$x] . $playimg[$imgIndex + 1][$x];

$arr['data'][$x]['img'] = $imgUrl;

$arr['data'][$x]['name'] .= ' ' . $imgName;

}

$arr['code'] = '200';

$arr['msg'] = '获取成功';

$arr['mun'] = $count;

$arr['type'] = 'true';

} else {

// 如果没有找到数据,设置错误信息

$arr['code'] = '404';

$arr['msg'] = '未找到数据';

}

return json_encode($arr, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_FORCE_OBJECT | JSON_UNESCAPED_SLASHES);

}

```

以下是重构后的代码:

```php

function get_data_360_tv($sign, $id, $order) {

$url = 'http://www.360kan.com/cover/switchsitev2?site=' . $sign . '&id=' . $id . '&category=' . $order;

$data = curl_get($url);

$arr = json_decode($data, true);

$str = $arr['data'];

$str = str_replace('" data-daochu="to=', '"data-daochu="to=', $str);

if ($order == 2) {

if (strpos($str, 'target="_self"') > 0) {

$str = getSubstr($str, '', '');

}

}

$arr['title'] = isset($title[1][0]) ? $title[1][0] : '获取失败,暂无相关资源';

$arr['msg'] = $arr['title'] === '获取失败,暂无相关资源' ? '获取失败,暂无相关资源' : '';

$arr['code'] = $arr['msg'] === '' ? '203' : '';

return json_encode($arr, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_FORCE_OBJECT | JSON_UNESCAPED_SLASHES);

}

```

以下是重构后的代码:

```php

$count = 0;

if (strpos($str, '

') > 0) {

$str = substr($str, strrpos($str, '

') + 1);

} else {

preg_match_all('##', $str, $play);

}

$count = count($play[1]);

for ($x = 0; $x < $count; $x++) {

$arrer['data'][$x]['num'] = $play[1][$x];

$arrer['data'][$x]['ori'] = $play[2][$x];

$arrer['data'][$x]['url'] = $play[3][$x];

}

$arrer['msg'] = '获取成功,为您找到' . $count . '集';

$arrer['code'] = '200';

$arrer['mun'] = $count;

```

请根据提供的内容完成内容重构,并保持段落结构:

```php

function get_data_360_list($mode) {

switch ($mode) {

case 'dianying':

$data = curl_get("http://www.360kan.com/dianying/list");

break;

case 'dianshi':

$data = curl_get("http://www.360kan.com/dianshi/list");

break;

case 'zongyi':

$data = curl_get("http://www.360kan.com/zongyi/list");

break;

case 'dongman':

$data = curl_get("http://www.360kan.com/dongman/list");

break;

default:

break;

}

preg_match_all('#(.*?)#', $data, $name);

preg_match_all('#(.*?)#', $data, $year);

preg_match_all('##', $data, $img);

$count = count($name[1]);

for ($x = 0; $x < $count; $x++) {

$arr[$x]['name'] = $name['1'][$x];

}

return json_encode($arr, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_FORCE_OBJECT | JSON_UNESCAPED_SLASHES);

}

```

重构后的代码如下:

```php

function getSubstr($str, $leftStr, $rightStr)

{

$left = strpos($str, $leftStr);

if ($left < 0 || $right < $left) return '';

return substr($str, $left + strlen($leftStr), $right - $left - strlen($leftStr));

}

function jsonEncodeArray($arr, $img)

{

foreach ($arr as $x => &$item) {

$item['em'] = isset($img[1][$x]) ? $img[1][$x] : '';

$item['img'] = 'http://' . (isset($img[1][$x]) ? $img[1][$x] : '');

}

return json_encode($arr, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_FORCE_OBJECT | JSON_UNESCAPED_SLASHES);

}

function curl_get($url)

{

$_var_1 = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11";

$_var_2 = curl_init();

curl_setopt($_var_2, CURLOPT_URL, $url);

curl_setopt($_var_2, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($_var_2, CURLOPT_FOLLOWLOCATION, 1);

curl_setopt($_var_2, CURLOPT_SSL_VERIFYPEER, false);

}

```

这段PHP代码的功能是使用curl库进行一个HTTP请求,其中包括以下步骤:

1. 禁用SSL证书验证(CURLOPT_SSL_VERIFYHOST选项设置为false);

2. 设置User-Agent头部信息(CURLOPT_USERAGENT选项设置为$_var_1的值);

3. 设置请求超时时间为3秒(CURLOPT_TIMEOUT选项设置为3);

4. 执行请求并获取响应内容(curl_exec函数执行请求),将结果存储在$_var_3变量中;

5. 关闭curl会话(curl_close函数关闭会话);

6. 返回获取到的响应内容($_var_3)。